Sha256: 50d0b10eca5788020f56f30efd54fbc4a07794d74ea0fa4eec75b26421867d55
Contents?: true
Size: 667 Bytes
Versions: 3
Compression:
Stored size: 667 Bytes
Contents
require "active_support/inflector" class Hash # Converts all of the keys to strings, optionally formatting key name def rubyify_keys! keys.each{|k| v = delete(k) new_key = k.to_s.underscore self[new_key] = v v.rubyify_keys! if v.is_a?(Hash) v.each{|p| p.rubyify_keys! if p.is_a?(Hash)} if v.is_a?(Array) } self end def billyfy_keys! keys.each{|k| v = delete(k) new_key = k.to_s.camelize(:lower) self[new_key] = v v.rubyify_keys! if v.is_a?(Hash) v.each{|p| p.billyfy_keys! if p.is_a?(Hash)} if v.is_a?(Array) } self end def success? self["success"] end end
Version data entries
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
billysbilling-rails-1.1.2 | lib/hash.rb |
billysbilling-rails-1.1.1 | lib/hash.rb |
billysbilling-rails-1.1.0 | lib/hash.rb |