Class: OldSchool::CSV::HeaderRow
- Inherits:
-
Object
- Object
- OldSchool::CSV::HeaderRow
- Defined in:
- lib/old_school/csv/header_row.rb
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(klass) ⇒ HeaderRow
constructor
A new instance of HeaderRow.
- #to_csv ⇒ Object
Constructor Details
#initialize(klass) ⇒ HeaderRow
Returns a new instance of HeaderRow.
8 9 10 |
# File 'lib/old_school/csv/header_row.rb', line 8 def initialize(klass) @klass = klass end |
Class Method Details
.for(klass) ⇒ Object
4 5 6 |
# File 'lib/old_school/csv/header_row.rb', line 4 def self.for(klass) new(klass).to_csv end |
Instance Method Details
#to_csv ⇒ Object
12 13 14 15 16 |
# File 'lib/old_school/csv/header_row.rb', line 12 def to_csv @klass.publicly_readable_attributes.map{|attribute| column_headers_for(attribute) }.flatten end |