Class: Grape::Util::LazyValueHash
- Inherits:
-
LazyValueEnumerable
- Object
- LazyValue
- LazyValueEnumerable
- Grape::Util::LazyValueHash
- Defined in:
- lib/grape/util/lazy_value.rb
Direct Known Subclasses
Instance Attribute Summary
Attributes inherited from LazyValue
Instance Method Summary collapse
- #evaluate ⇒ Object
-
#initialize(hash) ⇒ LazyValueHash
constructor
A new instance of LazyValueHash.
Methods inherited from LazyValueEnumerable
Methods inherited from LazyValue
#evaluate_from, #lazy?, #reached_by, #to_s
Constructor Details
#initialize(hash) ⇒ LazyValueHash
Returns a new instance of LazyValueHash.
80 81 82 83 84 85 86 |
# File 'lib/grape/util/lazy_value.rb', line 80 def initialize(hash) super @value_hash = {}.with_indifferent_access hash.each do |key, value| self[key] = value end end |
Instance Method Details
#evaluate ⇒ Object
88 89 90 91 92 93 94 |
# File 'lib/grape/util/lazy_value.rb', line 88 def evaluate evaluated = {}.with_indifferent_access @value_hash.each do |key, value| evaluated[key] = value.evaluate end evaluated end |