Module: CSVUtils::CSVRow
- Defined in:
- lib/csv_utils/csv_row.rb
Overview
Mixin that declares how an object turns into a CSV row, for use with CSVReport. Columns are inherited by subclasses.
Defined Under Namespace
Modules: ClassMethods
Class Method Summary collapse
- .included(base) ⇒ void private
Instance Method Summary collapse
-
#csv_headers ⇒ Array<String>
The header of each column.
-
#csv_row ⇒ Array
(also: #to_a)
The value of each column.
Class Method Details
.included(base) ⇒ void
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
This method returns an undefined value.
21 22 23 24 |
# File 'lib/csv_utils/csv_row.rb', line 21 def self.included(base) base.extend InheritanceHelper::Methods base.extend ClassMethods end |
Instance Method Details
#csv_headers ⇒ Array<String>
Returns the header of each column.
75 76 77 |
# File 'lib/csv_utils/csv_row.rb', line 75 def csv_headers self.class.csv_headers end |
#csv_row ⇒ Array Also known as: to_a
The value of each column.
69 70 71 |
# File 'lib/csv_utils/csv_row.rb', line 69 def csv_row self.class.csv_columns.values.map { || csv_column_value() } end |