Class: Exporter::Base

Inherits:
Object
  • Object
show all
Defined in:
lib/exporter/base.rb

Direct Known Subclasses

Approvals, Comments, Items

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(cart_model) ⇒ Base

Returns a new instance of Base.


5
6
7
# File 'lib/exporter/base.rb', line 5

def initialize(cart_model)
  @cart = cart_model
end

Instance Attribute Details

#cartObject (readonly)

Returns the value of attribute cart


3
4
5
# File 'lib/exporter/base.rb', line 3

def cart
  @cart
end

Instance Method Details

#to_csvObject


9
10
11
12
13
14
15
16
# File 'lib/exporter/base.rb', line 9

def to_csv
  CSV.generate do |csv|
    csv << self.headers
    self.rows.each do |row|
      csv << row
    end
  end
end