Class: MrCommon::DefaultCSVExportAdapter
- Inherits:
-
Object
- Object
- MrCommon::DefaultCSVExportAdapter
- Defined in:
- app/models/mr_common/default_csv_export_adapter.rb
Instance Attribute Summary collapse
-
#exportable ⇒ Object
readonly
Returns the value of attribute exportable.
Instance Method Summary collapse
- #collection ⇒ Object
- #headers ⇒ Object
-
#initialize(exportable) ⇒ DefaultCSVExportAdapter
constructor
A new instance of DefaultCSVExportAdapter.
- #row_from_item(item) ⇒ Object
Constructor Details
#initialize(exportable) ⇒ DefaultCSVExportAdapter
Returns a new instance of DefaultCSVExportAdapter.
7 8 9 |
# File 'app/models/mr_common/default_csv_export_adapter.rb', line 7 def initialize(exportable) @exportable = exportable end |
Instance Attribute Details
#exportable ⇒ Object (readonly)
Returns the value of attribute exportable.
5 6 7 |
# File 'app/models/mr_common/default_csv_export_adapter.rb', line 5 def exportable @exportable end |
Instance Method Details
#collection ⇒ Object
11 12 13 |
# File 'app/models/mr_common/default_csv_export_adapter.rb', line 11 def collection exportable.all end |
#headers ⇒ Object
19 20 21 |
# File 'app/models/mr_common/default_csv_export_adapter.rb', line 19 def headers exportable.column_names end |
#row_from_item(item) ⇒ Object
15 16 17 |
# File 'app/models/mr_common/default_csv_export_adapter.rb', line 15 def row_from_item(item) item.attributes.values_at(*headers) end |