Class: ActiveRecord::Extensions::FindToCSV::FieldMap

Inherits:
Object
  • Object
show all
Defined in:
lib/ar-extensions/csv.rb

Overview

:nodoc:

Instance Attribute Summary collapse

Instance Method Summary collapse

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

#fieldsObject (readonly)

Returns the value of attribute fields.



83
84
85
# File 'lib/ar-extensions/csv.rb', line 83

def fields
  @fields
end

#fields_to_headersObject (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

#headersObject

: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