Module: LpCSVExportable::CanExportAsCSV
- Defined in:
- lib/lp_csv_exportable/can_export_as_csv.rb
Defined Under Namespace
Modules: ClassMethods
Instance Attribute Summary collapse
-
#collection ⇒ Object
writeonly
Sets the attribute collection.
-
#column_class ⇒ Object
writeonly
Sets the attribute column_class.
Class Method Summary collapse
Instance Method Summary collapse
Instance Attribute Details
#collection=(value) ⇒ Object
Sets the attribute collection
3 4 5 |
# File 'lib/lp_csv_exportable/can_export_as_csv.rb', line 3 def collection=(value) @collection = value end |
#column_class=(value) ⇒ Object
Sets the attribute column_class
3 4 5 |
# File 'lib/lp_csv_exportable/can_export_as_csv.rb', line 3 def column_class=(value) @column_class = value end |
Class Method Details
.included(base) ⇒ Object
5 6 7 |
# File 'lib/lp_csv_exportable/can_export_as_csv.rb', line 5 def self.included(base) base.extend ClassMethods end |
Instance Method Details
#to_csv ⇒ Object
9 10 11 12 13 14 15 16 |
# File 'lib/lp_csv_exportable/can_export_as_csv.rb', line 9 def to_csv CSV.generate do |csv| csv << headers data_matrix.each do |row| csv << row end end end |