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
taps2-0.5.5 lib/taps/monkey.rb
taps2-0.5.4 lib/taps/monkey.rb
taps2-0.5.3 lib/taps/monkey.rb
taps2-0.5.2 lib/taps/monkey.rb
taps2-0.5.1 lib/taps/monkey.rb
tinroof-taps-0.3.24 lib/taps/monkey.rb
tapsicle-0.4.1 lib/taps/monkey.rb
taps-taps-0.3.24 lib/taps/monkey.rb
taps-0.3.24 lib/taps/monkey.rb
taps-0.3.23 lib/taps/monkey.rb
taps-0.3.23.pre1 lib/taps/monkey.rb
taps-0.3.22.pre2 lib/taps/monkey.rb
taps-0.3.22.pre1 lib/taps/monkey.rb
taps-0.3.21 lib/taps/monkey.rb
taps-0.3.20 lib/taps/monkey.rb
taps-0.3.20.pre2 lib/taps/monkey.rb
taps-0.3.20.pre1 lib/taps/monkey.rb
taps-0.3.19 lib/taps/monkey.rb
taps-0.3.19.pre1 lib/taps/monkey.rb
taps-0.3.18 lib/taps/monkey.rb