class Array
Public Instance Methods
to_h()
click to toggle source
# File lib/forkforge/internal/monkeypatches.rb, line 33 def to_h i = 0 self.inject({}) { |memo, e| raise TypeError.new("wrong element type #{e.class} at #{i} (expected array)") unless Array === e raise ArgumentError.new("wrong array length at #{i} (expected 2, was #{e.count})") unless e.count == 2 i += 1 memo[e.first] = e.last memo } end