Class: Decidim::FileAuthorizationHandler::CsvData
- Inherits:
-
Object
- Object
- Decidim::FileAuthorizationHandler::CsvData
- Defined in:
- app/models/decidim/file_authorization_handler/csv_data.rb
Class Attribute Summary collapse
-
.col_sep ⇒ Object
Returns the value of attribute col_sep.
Instance Attribute Summary collapse
-
#errors ⇒ Object
readonly
Returns the value of attribute errors.
-
#headers ⇒ Object
readonly
Returns the value of attribute headers.
-
#values ⇒ Object
readonly
Returns the value of attribute values.
Instance Method Summary collapse
-
#initialize(file) ⇒ CsvData
constructor
A new instance of CsvData.
Constructor Details
#initialize(file) ⇒ CsvData
Returns a new instance of CsvData.
13 14 15 16 17 18 19 20 21 22 23 |
# File 'app/models/decidim/file_authorization_handler/csv_data.rb', line 13 def initialize(file) @file = file @errors = [] @values = [] Rails.logger.info "CsvData.col_sep: #{CsvData.col_sep}" CSV.foreach(@file, headers: true, col_sep: CsvData.col_sep) do |row| @headers = row.headers process_row(row) end end |
Class Attribute Details
.col_sep ⇒ Object
Returns the value of attribute col_sep.
9 10 11 |
# File 'app/models/decidim/file_authorization_handler/csv_data.rb', line 9 def col_sep @col_sep end |
Instance Attribute Details
#errors ⇒ Object (readonly)
Returns the value of attribute errors.
11 12 13 |
# File 'app/models/decidim/file_authorization_handler/csv_data.rb', line 11 def errors @errors end |
#headers ⇒ Object (readonly)
Returns the value of attribute headers.
11 12 13 |
# File 'app/models/decidim/file_authorization_handler/csv_data.rb', line 11 def headers @headers end |
#values ⇒ Object (readonly)
Returns the value of attribute values.
11 12 13 |
# File 'app/models/decidim/file_authorization_handler/csv_data.rb', line 11 def values @values end |