--- !ruby/object:RI::MethodDescription 
aliases: []

block_params: 
comment: 
- !ruby/struct:SM::Flow::P 
  body: "Converts an array into a hash. Converting an array into a hash is not a one-to-one conversion, for this reason #to_h examines at the array being converted and then dispatches the conversion to the most sutiable specialized function. There are three possiblities for this."
- !ruby/struct:SM::Flow::P 
  body: "If the array is a collection of perfect pairs, like that which Hash#to_a generates, then conversion is handled by #to_h_flat."
- !ruby/struct:SM::Flow::VERB 
  body: "  a = [ [:a,1], [:b,2] ]\n  a.to_h  #=&gt; { :a=&gt;1, :b=&gt;2 }\n"
- !ruby/struct:SM::Flow::P 
  body: "If the array contains only arrays, but are not perfect pairs, then #to_h_multi is called."
- !ruby/struct:SM::Flow::VERB 
  body: "  a = [ [:a,1,2], [:b,2], [:c], [:d] ]\n  a.to_h  #=&gt; { :a=&gt;[1,2], :b=&gt;[2], :c=&gt;[], :d=&gt;[] }\n"
- !ruby/struct:SM::Flow::P 
  body: "If the array contians objects other then arrays then the #to_h_splat method is called."
- !ruby/struct:SM::Flow::VERB 
  body: "  a = [ [:a,1,2], 2, :b, [:c,3], 9 ]\n  a.to_h  #=&gt; { [:a,1,2]=&gt;2, :b=&gt;[:c,3], 9=&gt;nil }\n"
- !ruby/struct:SM::Flow::P 
  body: Finally, a particular dispatch can be forced by specifying the <tt>mode</tt> of conversion, eg. +:multi+, +:splat+, +:flat+, +:assoc+, etc.
- !ruby/struct:SM::Flow::P 
  body: Setting <tt>mode</tt> to <tt>true</tt> is the same as setting it +:multi+. This has been left in for backward compatability.
- !ruby/struct:SM::Flow::P 
  body: "NOTE: The use of a <tt>values</tt> parameter has been deprecated because that functionality is as simple as:"
- !ruby/struct:SM::Flow::VERB 
  body: "  array1.zip(array2).to_h\n"
- !ruby/struct:SM::Flow::P 
  body: "CREDIT: Robert Klemme CREDIT: Trans"
full_name: Array#to_h
is_singleton: false
name: to_h
params: (mode=nil)
visibility: public
