Sha256: 06c38368dd020fe417a98d08c45859b536121a14eacf488f3ff6ff7218205fdb

Contents?: true

Size: 385 Bytes

Versions: 26

Compression:

Stored size: 385 Bytes

Contents

class Hash
  def symbolize_keys
    inject({}) do |options, (key, value)|
      options[(key.to_sym rescue key) || key] = value
      options
    end
  end

  def symbolize_keys!
    self.replace(symbolize_keys)
  end

  def symbolize_recursively!
    self.replace(symbolize_keys)
    self.each do |k, v|
      if v.kind_of?(Hash)
        v.symbolize_keys!
      end
    end
  end
end

Version data entries

26 entries across 26 versions & 6 rubygems

Version Path
taps-0.3.17 lib/taps/monkey.rb
taps-0.3.15 lib/taps/monkey.rb
taps-jruby-0.3.14 lib/taps/monkey.rb
taps-0.3.14 lib/taps/monkey.rb
taps-0.3.13 lib/taps/monkey.rb
taps-0.3.12 lib/taps/monkey.rb