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.16.5 lib/hydra/hash.rb
hydra-0.16.4 lib/hydra/hash.rb
hydra-0.16.3 lib/hydra/hash.rb
hydra-0.16.2 lib/hydra/hash.rb
hydra-0.16.1 lib/hydra/hash.rb
hydra-0.16.0 lib/hydra/hash.rb
hydra-0.15.1 lib/hydra/hash.rb
hydra-0.15.0 lib/hydra/hash.rb
hydra-0.14.1 lib/hydra/hash.rb
hydra-0.14.0 lib/hydra/hash.rb
hydra-0.13.0 lib/hydra/hash.rb
hydra-0.12.0 lib/hydra/hash.rb
hydra-0.11.0 lib/hydra/hash.rb
hydra-0.10.3 lib/hydra/hash.rb
hydra-0.10.2 lib/hydra/hash.rb
hydra-0.10.1 lib/hydra/hash.rb
hydra-0.10.0 lib/hydra/hash.rb
hydra-0.9.0 lib/hydra/hash.rb
hydra-0.8.0 lib/hydra/hash.rb
hydra-0.7.2 lib/hydra/hash.rb