Class: CaseInsensitiveHash

Inherits:
Hash
  • Object
show all
Defined in:
lib/audioinfo/case_insensitive_hash.rb

Instance Method Summary collapse

Constructor Details

#initialize(hash = {}) ⇒ CaseInsensitiveHash

Returns a new instance of CaseInsensitiveHash.



4
5
6
7
8
9
# File 'lib/audioinfo/case_insensitive_hash.rb', line 4

def initialize(hash = {})
  super
  hash.each do |key, value|
    self[key.downcase] = value
  end
end

Instance Method Details

#[](key) ⇒ Object



11
12
13
# File 'lib/audioinfo/case_insensitive_hash.rb', line 11

def [](key)
  super(key.downcase)
end

#[]=(key, value) ⇒ Object



15
16
17
# File 'lib/audioinfo/case_insensitive_hash.rb', line 15

def []=(key, value)
  super(key.downcase, value)
end