Sha256: c813619cd7a60cb77a889c8f5418e5df57f59338e00684c8e4f1a13bb0821f92

Contents?: true

Size: 420 Bytes

Versions: 11

Compression:

Stored size: 420 Bytes

Contents

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

  def symbolize_keys!
    replace(symbolize_keys)
  end

  def symbolize_recursively!
    replace(symbolize_keys)
    each do |_k, v|
      v.symbolize_keys! if v.is_a?(Hash)
    end
  end
end

Version data entries

11 entries across 11 versions & 1 rubygems

Version Path
taps2-0.6.10 lib/taps/monkey.rb
taps2-0.6.9 lib/taps/monkey.rb
taps2-0.6.8 lib/taps/monkey.rb
taps2-0.6.7 lib/taps/monkey.rb
taps2-0.6.6 lib/taps/monkey.rb
taps2-0.6.5 lib/taps/monkey.rb
taps2-0.6.4 lib/taps/monkey.rb
taps2-0.6.3 lib/taps/monkey.rb
taps2-0.6.2 lib/taps/monkey.rb
taps2-0.6.1 lib/taps/monkey.rb
taps2-0.6.0 lib/taps/monkey.rb