Class: Grape::Util::LazyValueArray
- Inherits:
-
LazyValueEnumerable
- Object
- LazyValue
- LazyValueEnumerable
- Grape::Util::LazyValueArray
- Defined in:
- lib/grape/util/lazy_value.rb
Instance Attribute Summary
Attributes inherited from LazyValue
Instance Method Summary collapse
- #evaluate ⇒ Object
-
#initialize(array) ⇒ LazyValueArray
constructor
A new instance of LazyValueArray.
Methods inherited from LazyValueEnumerable
Methods inherited from LazyValue
#evaluate_from, #lazy?, #reached_by, #to_s
Constructor Details
#initialize(array) ⇒ LazyValueArray
Returns a new instance of LazyValueArray.
64 65 66 67 68 69 70 |
# File 'lib/grape/util/lazy_value.rb', line 64 def initialize(array) super @value_hash = [] array.each_with_index do |value, index| self[index] = value end end |
Instance Method Details
#evaluate ⇒ Object
72 73 74 75 76 77 78 |
# File 'lib/grape/util/lazy_value.rb', line 72 def evaluate evaluated = [] @value_hash.each_with_index do |value, index| evaluated[index] = value.evaluate end evaluated end |