Class: Grape::Util::Lazy::ValueArray
- Inherits:
-
ValueEnumerable
- Object
- Value
- ValueEnumerable
- Grape::Util::Lazy::ValueArray
- Defined in:
- lib/grape/util/lazy/value_array.rb
Instance Attribute Summary
Attributes inherited from Value
Instance Method Summary collapse
- #evaluate ⇒ Object
-
#initialize(array) ⇒ ValueArray
constructor
A new instance of ValueArray.
Methods inherited from ValueEnumerable
Methods inherited from Value
#evaluate_from, #lazy?, #reached_by, #to_s
Constructor Details
#initialize(array) ⇒ ValueArray
Returns a new instance of ValueArray.
7 8 9 10 11 12 13 |
# File 'lib/grape/util/lazy/value_array.rb', line 7 def initialize(array) super @value_hash = [] array.each_with_index do |value, index| self[index] = value end end |
Instance Method Details
#evaluate ⇒ Object
15 16 17 |
# File 'lib/grape/util/lazy/value_array.rb', line 15 def evaluate @value_hash.map(&:evaluate) end |