Class: CsvBlueprints::RepeatedValue

Inherits:
Object
  • Object
show all
Defined in:
lib/csv_blueprints/blueprint.rb

Instance Method Summary collapse

Constructor Details

#initialize(callable, max_repetitions) ⇒ RepeatedValue

Returns a new instance of RepeatedValue.



13
14
15
16
17
18
# File 'lib/csv_blueprints/blueprint.rb', line 13

def initialize(callable, max_repetitions)
  @callable = callable
  @max_repetitions = max_repetitions
  @repetitions = 0
  @value = nil
end

Instance Method Details

#call(index) ⇒ Object



20
21
22
23
24
# File 'lib/csv_blueprints/blueprint.rb', line 20

def call(index)
  calculate_value(index)
  increment_repetitions
  value
end