Class: Data::Criteria::HashProxy
- Inherits:
-
Object
- Object
- Data::Criteria::HashProxy
- Defined in:
- lib/data/criteria/hash_proxy.rb
Instance Method Summary collapse
- #[](k) ⇒ Object
-
#initialize(hash) ⇒ HashProxy
constructor
A new instance of HashProxy.
- #key?(k) ⇒ Boolean
Constructor Details
#initialize(hash) ⇒ HashProxy
4 5 6 |
# File 'lib/data/criteria/hash_proxy.rb', line 4 def initialize(hash) @hash = hash end |
Instance Method Details
#[](k) ⇒ Object
8 9 10 |
# File 'lib/data/criteria/hash_proxy.rb', line 8 def [](k) @hash.fetch(k, nil) || @hash.fetch(k.to_sym, nil) || @hash.fetch(k.to_s, nil) || @hash[k] end |
#key?(k) ⇒ Boolean
12 13 14 |
# File 'lib/data/criteria/hash_proxy.rb', line 12 def key?(k) @hash.key?(k) || @hash.key?(k.to_sym) || @hash.key?(k.to_s) end |