Class: CsvBlueprints::Plan
- Inherits:
-
Object
- Object
- CsvBlueprints::Plan
show all
- Defined in:
- lib/csv_blueprints/plan.rb
Defined Under Namespace
Classes: CustomizedRow, StandardRow
Instance Method Summary
collapse
Constructor Details
#initialize(blueprint) ⇒ Plan
Returns a new instance of Plan.
27
28
29
30
|
# File 'lib/csv_blueprints/plan.rb', line 27
def initialize(blueprint)
@blueprint = blueprint
@rows = []
end
|
Instance Method Details
#add_row(overrides = {}) ⇒ Object
32
33
34
35
36
37
38
|
# File 'lib/csv_blueprints/plan.rb', line 32
def add_row(overrides = {})
if overrides.any?
@rows << CustomizedRow.new(overrides)
else
@rows << StandardRow.new
end
end
|
#column_names ⇒ Object
40
41
42
|
# File 'lib/csv_blueprints/plan.rb', line 40
def column_names
@blueprint.column_names
end
|
#each_row ⇒ Object
44
45
46
47
48
|
# File 'lib/csv_blueprints/plan.rb', line 44
def each_row
@rows.each.with_index do |row, index|
yield row.values_for(index + 1, @blueprint)
end
end
|