Sha256: 6c6522ed846e6be16123180fcf1978bf5bcec4419fa2b990aa5f79d812f119b3
Contents?: true
Size: 693 Bytes
Versions: 1
Compression:
Stored size: 693 Bytes
Contents
require File.join(File.dirname(__FILE__), '../deprecation') module ROXML module CoreExtensions module Array #:nodoc: module Conversions # Translates an array into a hash, where each element of the array is # an array with 2 elements: # # >> [[:key, :value], [1, 2], ['key', 'value']].to_h # => {:key => :value, 1 => 2, 'key' => 'value'} # def to_hash inject({}) do |result, (k, v)| result[k] = v result end end def to_h #:nodoc: ActiveSupport::Deprecation.warn "Please use #to_hash instead" to_hash end end end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
Empact-roxml-2.2 | lib/roxml/extensions/array/conversions.rb |