Hash

Hash

ri

 ------------------------------------------------------------ Class: Hash
      A  Hash  is a collection of key-value pairs. It is similar to an
       Array , 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.
 
      Hashes have a _default value_ that is returned when accessing keys
      that do not exist in the hash. By default, that value is  nil .
 
 ------------------------------------------------------------------------
 
 
 Includes:
 ---------
      Enumerable(all?, any?, collect, detect, each_cons, each_slice,
      each_with_index, entries, enum_cons, enum_slice, enum_with_index,
      find, find_all, grep, include?, inject, map, max, member?, min,
      partition, reject, select, sort, sort_by, to_a, to_set, zip)
 
 
 Class methods:
 --------------
      [], new
 
 
 Instance methods:
 -----------------
      ==, , =, clear, default, default=, default_proc, delete,
      delete_if, each, each_key, each_pair, each_value, empty?, fetch,
      has_key?, has_value?, include?, index, indexes, indices,
      initialize_copy, inspect, invert, key?, keys, length, member?,
      merge, merge!, rehash, reject, reject!, replace, select, shift,
      size, sort, store, to_a, to_hash, to_s, update, value?, values,
      values_at

refe

 ==== Hash ====
 ハッシュテーブル(連想配列とも呼ぶ)のクラスハッシュは任意の種類のオブ
 ジェクトから任意の種類のオブジェクトへの関連づけを行うことができます。
 ハッシュ生成は以下のようなハッシュ式で行われます。
 
   {a=>b, ... }
 
 ハッシュの格納に用いられるハッシュ値の計算には、
 Object#hash [Object/hash] メソッドが使われ、キーの同一性判定には、
 Object#eql? [Object/eql?] メソッドが使われます。
 
 キーとして与えたオブジェクトの内容が変化し、メソッド hash の返す
 値が変わるとハッシュから値が取り出せなくなりますから、ArrayHash などのインスタンスはキーに向きません。文字列をキーとして与
 えると、文字列をコピーし、コピーを更新不可に設定(freeze)してキーとして
 使用します。キーとして使われている文字列を更新しようとすると例外 
 TypeError が発生します。
 ---- Singleton methods ----
 [] new
 ---- Instance methods ----
  = clear clone default default= default_proc delete
 delete_if dup each each_key each_pair each_value empty?
 fetch has_key? has_value? include? index indexes indices
 invert key? keys length member? merge merge! rehash reject
 reject! replace shift size store to_a to_hash update value?
 values values_at
 ---- Singleton methods (inherited) ----
 ---- Instance methods (inherited) ----
 == === =~ __id__ __send__ _dump _load all? any? class
 collect detect display each_with_index entries eql? equal?
 extend find find_all freeze frozen? grep hash id initialize
 initialize_copy inject inspect instance_eval instance_of?
 instance_variable_get instance_variable_set
 instance_variables is_a? kind_of? map marshal_dump
 marshal_load max method method_missing methods min nil?
 object_id partition pretty_print pretty_print_cycle
 pretty_print_instance_variables private_methods
 protected_methods public_methods remove_instance_variable
 respond_to? select send singleton_method_added
 singleton_method_removed singleton_method_undefined
 singleton_methods sort sort_by taint tainted? to_ary to_int
 to_s to_str type untaint zip