📜
RGSS Reference Manual
  • RGSS Reference Manual
  • RGSS Specifications
  • Ruby Syntax
    • Syntax and Expressions
    • Variables and Constants
    • Literals
    • Operator Expressions
    • Control Structures
    • Method Calls
    • Class and Method Definitions
  • Standard Library
    • Built-in Functions
    • Built-in Variables
    • Built-in Classes
      • Object
        • Array
        • Exception
        • FalseClass
        • Hash
        • IO
          • File
        • MatchData
        • Module
          • Class
        • NilClass
        • Numeric
          • Integer
            • Bignum
            • Fixnum
          • Float
        • Range
        • Proc
        • Regexp
        • String
        • Symbol
        • Time
        • TrueClass
    • Built-in Modules
      • Comparable
      • Enumerable
      • Errno
      • FileTest
      • GC
      • Kernel
      • Marshal
      • Math
    • Built-in Exception Classes
  • Game Library
    • RGSS Built-in Functions
    • RGSS Built-in Classes
      • Bitmap
      • Color
      • Font
      • Plane
      • Rect
      • Sprite
      • Table
      • Tilemap
      • Tone
      • Viewport
      • Window
      • RGSSError
      • RPG::Sprite
      • RPG::Weather
    • RGSS Built-in Modules
      • Audio
      • Graphics
      • Input
      • RPG
      • RPG::Cache
    • RPGXP Data Structures
      • RPG::Map
      • RPG::MapInfo
      • RPG::Event
      • RPG::Event::Page
      • RPG::Event::Page::Condition
      • RPG::Event::Page::Graphic
      • RPG::EventCommand
      • RPG::MoveRoute
      • RPG::MoveCommand
      • RPG::Actor
      • RPG::Class
      • RPG::Class::Learning
      • RPG::Skill
      • RPG::Item
      • RPG::Weapon
      • RPG::Armor
      • RPG::Enemy
      • RPG::Enemy::Action
      • RPG::Troop
      • RPG::Troop::Member
      • RPG::Troop::Page
      • RPG::Troop::Page::Condition
      • RPG::State
      • RPG::Animation
      • RPG::Animation::Frame
      • RPG::Animation::Timing
      • RPG::Tileset
      • RPG::CommonEvent
      • RPG::System
      • RPG::System::Words
      • RPG::System::TestBattler
      • RPG::AudioFile
  • Appendix
    • Regular Expression
    • sprintf Format
Powered by GitBook
On this page
  1. Standard Library
  2. Built-in Classes
  3. Object

Hash

self[key]

Returns the value mapped to key. If the corresponding key is not registered, returns the default value (or nil if not specified).

self[key]=value

Maps value to key. Returns value.

clear

Clears the hash contents. Returns self.

clonedup

Returns a new hash with the same contents as the receiver. Using clone on a frozen hash will return a similarly frozen hash, but dup returns an unfrozen hash with identical contents.

Returns value.

delete(key)delete(key) {|key| ... }

Deletes the mapping from key. Returns the removed value, or nil if there is no value corresponding to key.

When the method has been supplied with a block, it will be evaluated and the results returned if there is no match for key.

each {|key, value| ... }each_pair {|key, value| ... }

Evaluates a block with key and value as arguments. Returns self.

each_key {|key| ... }

Evaluates a block with key as the argument. Returns self.

each_value {|value| ... }

Evaluates a block with value as the argument. Returns self.

empty?

Returns true when the hash is empty.

has_key?(key)include?(key)

Returns true when the hash includes key as a key.

has_value?(value)

Returns true when the hash includes value as a value as determined by ==.

index(val)

Returns the key corresponding to val. If there is no corresponding element, returns nil.

If there are multiple corresponding keys, arbitrarily returns one of them.

keys

Returns an array of all keys.

lengthsize

Returns the number of elements in the hash.

values

Returns an array of all values in the hash.

PreviousFalseClassNextIO

Last updated 2 years ago