Class: Sift::Utils::HashGetter
- Inherits:
-
Object
- Object
- Sift::Utils::HashGetter
- Defined in:
- lib/sift/utils/hash_getter.rb
Instance Attribute Summary collapse
-
#hash ⇒ Object
readonly
Returns the value of attribute hash.
Instance Method Summary collapse
- #get(value) ⇒ Object
-
#initialize(hash) ⇒ HashGetter
constructor
A new instance of HashGetter.
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
#hash ⇒ Object (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 |