Sha256: 1db743f8893a49ab7414d6536690af7f947382a88f06e7e599f33d97a8b93f3f
Contents?: true
Size: 439 Bytes
Versions: 3
Compression:
Stored size: 439 Bytes
Contents
Hash.class_eval do def self.convert_keys(hash, method = :underscore) if hash.is_a?(Array) hash.collect {|h| convert_keys(h, method) } elsif hash.is_a?(Hash) hash_array = hash.collect do |key,value| [ key.to_s.send(method), convert_keys(value, method) ] end Hash[hash_array] else hash end end def convert_keys(method = :underscore) Hash.convert_keys self, method end end
Version data entries
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
hash-pipe-0.1.1 | lib/hash_pipe/key_conversion.rb |
hash-pipe-0.1.0 | lib/hash_pipe/key_conversion.rb |
hash-pipe-0.0.2 | lib/hash_pipe/key_conversion.rb |