AlkantarClanX12
Current Path : /opt/alt/ruby18/share/ri/1.8/system/Hash/ |
Current File : //opt/alt/ruby18/share/ri/1.8/system/Hash/cdesc-Hash.yaml |
--- !ruby/object:RI::ClassDescription attributes: [] class_methods: - !ruby/object:RI::MethodSummary name: "[]" - !ruby/object:RI::MethodSummary name: new comment: - !ruby/struct:SM::Flow::P body: A <tt>Hash</tt> is a collection of key-value pairs. It is similar to an <tt>Array</tt>, except that indexing is done via arbitrary keys of any object type, not an integer index. The order in which you traverse a hash by either key or value may seem arbitrary, and will generally not be in the insertion order. - !ruby/struct:SM::Flow::P body: Hashes have a <em>default value</em> that is returned when accessing keys that do not exist in the hash. By default, that value is <tt>nil</tt>. - !ruby/struct:SM::Flow::P body: <tt>Hash</tt> uses <tt>key.eql?</tt> to test keys for equality. If you need to use instances of your own classes as keys in a <tt>Hash</tt>, it is recommended that you define both the <tt>eql?</tt> and <tt>hash</tt> methods. The <tt>hash</tt> method must have the property that <tt>a.eql?(b)</tt> implies <tt>a.hash == b.hash</tt>. - !ruby/struct:SM::Flow::VERB body: " class MyClass\n attr_reader :str\n def initialize(str)\n @str = str\n end\n def eql?(o)\n o.is_a?(MyClass) && str == o.str\n end\n def hash\n @str.hash\n end\n end\n\n a = MyClass.new("some string")\n b = MyClass.new("some string")\n a.eql? b #=> true\n\n h = {}\n\n h[a] = 1\n h[a] #=> 1\n h[b] #=> 1\n\n h[b] = 2\n h[a] #=> 2\n h[b] #=> 2\n" constants: [] full_name: Hash includes: - !ruby/object:RI::IncludedModule name: Enumerable instance_methods: - !ruby/object:RI::MethodSummary name: == - !ruby/object:RI::MethodSummary name: "[]" - !ruby/object:RI::MethodSummary name: "[]=" - !ruby/object:RI::MethodSummary name: clear - !ruby/object:RI::MethodSummary name: default - !ruby/object:RI::MethodSummary name: default= - !ruby/object:RI::MethodSummary name: default_proc - !ruby/object:RI::MethodSummary name: delete - !ruby/object:RI::MethodSummary name: delete_if - !ruby/object:RI::MethodSummary name: each - !ruby/object:RI::MethodSummary name: each_key - !ruby/object:RI::MethodSummary name: each_pair - !ruby/object:RI::MethodSummary name: each_value - !ruby/object:RI::MethodSummary name: empty? - !ruby/object:RI::MethodSummary name: eql? - !ruby/object:RI::MethodSummary name: fetch - !ruby/object:RI::MethodSummary name: has_key? - !ruby/object:RI::MethodSummary name: has_value? - !ruby/object:RI::MethodSummary name: hash - !ruby/object:RI::MethodSummary name: include? - !ruby/object:RI::MethodSummary name: index - !ruby/object:RI::MethodSummary name: indexes - !ruby/object:RI::MethodSummary name: indices - !ruby/object:RI::MethodSummary name: initialize_copy - !ruby/object:RI::MethodSummary name: inspect - !ruby/object:RI::MethodSummary name: invert - !ruby/object:RI::MethodSummary name: key? - !ruby/object:RI::MethodSummary name: keys - !ruby/object:RI::MethodSummary name: length - !ruby/object:RI::MethodSummary name: member? - !ruby/object:RI::MethodSummary name: merge - !ruby/object:RI::MethodSummary name: merge! - !ruby/object:RI::MethodSummary name: pretty_print - !ruby/object:RI::MethodSummary name: pretty_print_cycle - !ruby/object:RI::MethodSummary name: rehash - !ruby/object:RI::MethodSummary name: reject - !ruby/object:RI::MethodSummary name: reject! - !ruby/object:RI::MethodSummary name: replace - !ruby/object:RI::MethodSummary name: select - !ruby/object:RI::MethodSummary name: shift - !ruby/object:RI::MethodSummary name: size - !ruby/object:RI::MethodSummary name: sort - !ruby/object:RI::MethodSummary name: store - !ruby/object:RI::MethodSummary name: to_a - !ruby/object:RI::MethodSummary name: to_hash - !ruby/object:RI::MethodSummary name: to_s - !ruby/object:RI::MethodSummary name: to_yaml - !ruby/object:RI::MethodSummary name: update - !ruby/object:RI::MethodSummary name: value? - !ruby/object:RI::MethodSummary name: values - !ruby/object:RI::MethodSummary name: values_at - !ruby/object:RI::MethodSummary name: yaml_initialize name: Hash superclass: Object