Class: Data::Criteria::HashProxy

Inherits:
Object
  • Object
show all
Defined in:
lib/data/criteria/hash_proxy.rb

Instance Method Summary collapse

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