Sha256: faf4592c2a46260fb956b7db689613f94742fdec01a2e84980e04dbc14fa80f5

Contents?: true

Size: 338 Bytes

Versions: 61

Compression:

Stored size: 338 Bytes

Contents

class Hash
  # Stringify the keys in the hash. Returns a new hash.
  def stringify_keys
    inject({}) do |options, (key, value)|
      options[key.to_s] = value
      options
    end
  end
  # Stringify the keys in the hash in place.
  def stringify_keys!
   keys.each do |key|
     self[key.to_s] = delete(key)
   end
   self
  end
end

Version data entries

61 entries across 61 versions & 8 rubygems

Version Path
hydra-0.7.0 lib/hydra/hash.rb