Flowdock
method

to_h

Importance_1
v2_6_3 - Show latest stable - 0 notes - Class: Array
to_h() public

Returns the result of interpreting ary as an array of [key, value] pairs.

[[:foo, :bar], [1, 2]].to_h
  # => {:foo => :bar, 1 => 2}

If a block is given, the results of the block on each element of the array will be used as pairs.

["foo", "bar"].to_h {|s| [s.ord, s]}
  # => {102=>"foo", 98=>"bar"}
Show source
Register or log in to add new notes.