Class: Sift::Utils::HashGetter

Inherits:
Object
  • Object
show all
Defined in:
lib/sift/utils/hash_getter.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(hash) ⇒ HashGetter

Returns a new instance of HashGetter.



6
7
8
# File 'lib/sift/utils/hash_getter.rb', line 6

def initialize(hash)
  @hash = hash
end

Instance Attribute Details

#hashObject (readonly)

Returns the value of attribute hash.



4
5
6
# File 'lib/sift/utils/hash_getter.rb', line 4

def hash
  @hash
end

Instance Method Details

#get(value) ⇒ Object



10
11
12
# File 'lib/sift/utils/hash_getter.rb', line 10

def get(value)
  hash[value.to_sym] || hash[value.to_s]
end