class IndifferentHash

Public Class Methods

from_hash(source, dest = IndifferentHash.new) click to toggle source
# File lib/indifferent-hash.rb, line 23
def self.from_hash(source, dest = IndifferentHash.new)
  source.each do |key, value|
    case value
    when Hash
      dest[key] = from_hash(value)
    else
      dest[key] = value
    end
  end

  dest
end

Public Instance Methods

[](key) click to toggle source
Calls superclass method
# File lib/indifferent-hash.rb, line 2
def [](key)
  super(key.to_s)
end
[]=(key, value) click to toggle source
Calls superclass method
# File lib/indifferent-hash.rb, line 6
def []=(key, value)
  super(key.to_s, value)
end
delete(key) click to toggle source
Calls superclass method
# File lib/indifferent-hash.rb, line 19
def delete(key)
  super(key.to_s)
end
except(*keys) click to toggle source
# File lib/indifferent-hash.rb, line 10
def except(*keys)
  dup.except!(*keys)
end
except!(*keys) click to toggle source
# File lib/indifferent-hash.rb, line 14
def except!(*keys)
  keys.each { |key| delete(key) }
  self
end