Class: Grape::Util::Lazy::ValueArray

Inherits:
ValueEnumerable show all
Defined in:
lib/grape/util/lazy/value_array.rb

Instance Attribute Summary

Attributes inherited from Value

#access_keys

Instance Method Summary collapse

Methods inherited from ValueEnumerable

#[], #[]=, #fetch

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

#evaluateObject



15
16
17
# File 'lib/grape/util/lazy/value_array.rb', line 15

def evaluate
  @value_hash.map(&:evaluate)
end