Sha256: 3970abf3f23dc7690519ea0f10d525e9ec5747d888b21de0b9d57732dcc8f047
Contents?: true
Size: 417 Bytes
Versions: 2
Compression:
Stored size: 417 Bytes
Contents
class Array def extract_options! last.is_a?(::Hash) ? pop : {} end end 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 end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
hoptoad-api-2.0.1 | lib/hoptoad-api/core_extensions.rb |
hoptoad-api-2.0.0 | lib/hoptoad-api/core_extensions.rb |