Class: ActiveRecord::Extensions::FindToCSV::FieldMap
- Inherits:
-
Object
- Object
- ActiveRecord::Extensions::FindToCSV::FieldMap
- Defined in:
- lib/ar-extensions/csv.rb
Overview
:nodoc:
Instance Attribute Summary collapse
-
#fields ⇒ Object
readonly
Returns the value of attribute fields.
-
#fields_to_headers ⇒ Object
readonly
Returns the value of attribute fields_to_headers.
Instance Method Summary collapse
-
#headers ⇒ Object
:nodoc:.
-
#initialize(fields, fields_to_headers) ⇒ FieldMap
constructor
:nodoc:.
Constructor Details
#initialize(fields, fields_to_headers) ⇒ FieldMap
:nodoc:
85 86 87 |
# File 'lib/ar-extensions/csv.rb', line 85 def initialize( fields, fields_to_headers ) # :nodoc: @fields, @fields_to_headers = fields, fields_to_headers end |
Instance Attribute Details
#fields ⇒ Object (readonly)
Returns the value of attribute fields.
83 84 85 |
# File 'lib/ar-extensions/csv.rb', line 83 def fields @fields end |
#fields_to_headers ⇒ Object (readonly)
Returns the value of attribute fields_to_headers.
83 84 85 |
# File 'lib/ar-extensions/csv.rb', line 83 def fields_to_headers @fields_to_headers end |
Instance Method Details
#headers ⇒ Object
:nodoc:
89 90 91 |
# File 'lib/ar-extensions/csv.rb', line 89 def headers # :nodoc: @headers ||= fields.inject( [] ){ |arr,field| arr << fields_to_headers[ field ] } end |