Method: Array#to_h
- Defined in:
- lib/exts/array.rb
#to_h ⇒ Object
25 26 27 28 |
# File 'lib/exts/array.rb', line 25 def to_h return {} unless self.all? {|a| a.is_a?(Symbol) || a.is_a?(String)} self.inject({}) {|h,a| h[a] = a;h } end |