Class: Buckaruby::Support::CaseInsensitiveHash
- Inherits:
-
Hash
- Object
- Hash
- Buckaruby::Support::CaseInsensitiveHash
- Defined in:
- lib/buckaruby/support/case_insensitive_hash.rb
Overview
The case insensitive Hash is a Hash with case insensitive keys that can also be accessed by using a Symbol.
Instance Method Summary collapse
- #[](key) ⇒ Object
- #[]=(key, value) ⇒ Object
-
#initialize(constructor = {}) ⇒ CaseInsensitiveHash
constructor
A new instance of CaseInsensitiveHash.
Constructor Details
#initialize(constructor = {}) ⇒ CaseInsensitiveHash
Returns a new instance of CaseInsensitiveHash.
8 9 10 11 12 13 14 15 |
# File 'lib/buckaruby/support/case_insensitive_hash.rb', line 8 def initialize(constructor = {}) if constructor.is_a?(Hash) super() update(constructor) else super end end |
Instance Method Details
#[](key) ⇒ Object
17 18 19 |
# File 'lib/buckaruby/support/case_insensitive_hash.rb', line 17 def [](key) super(convert_key(key)) end |
#[]=(key, value) ⇒ Object
21 22 23 |
# File 'lib/buckaruby/support/case_insensitive_hash.rb', line 21 def []=(key, value) super(convert_key(key), value) end |