Class: CsvBlueprints::PlanWriter

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

Instance Method Summary collapse

Constructor Details

#initialize(plan) ⇒ PlanWriter

Returns a new instance of PlanWriter.



5
6
7
# File 'lib/csv_blueprints/plan_writer.rb', line 5

def initialize(plan)
  @plan = plan
end

Instance Method Details

#write(out) ⇒ Object



9
10
11
12
13
14
15
# File 'lib/csv_blueprints/plan_writer.rb', line 9

def write(out)
  csv = CSV.new(out, headers: @plan.column_names, write_headers: true)

  @plan.each_row { |row| csv << row }

  csv
end