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
Constructor Details
#initialize(array) ⇒ LazyValueArray
Returns a new instance of LazyValueArray.
55 56 57 58 59 60 61 |
# File 'lib/grape/util/lazy_value.rb', line 55 def initialize(array) super @value_hash = [] array.each_with_index do |value, index| self[index] = value end end |
Instance Method Details
#evaluate ⇒ Object
63 64 65 66 67 68 69 |
# File 'lib/grape/util/lazy_value.rb', line 63 def evaluate evaluated = [] @value_hash.each_with_index do |value, index| evaluated[index] = value.evaluate end evaluated end |