Class: Decidim::Verifications::CsvCensus::Data
- Inherits:
-
Object
- Object
- Decidim::Verifications::CsvCensus::Data
- Defined in:
- app/models/decidim/verifications/csv_census/data.rb
Overview
A data processor for get emails data form a csv file
Enable this methods:
-
.error with an array of rows with errors in the csv file
-
.values an array with emails read from the csv file
Returns nothing
Instance Attribute Summary collapse
-
#errors ⇒ Object
readonly
Returns the value of attribute errors.
-
#values ⇒ Object
readonly
Returns the value of attribute values.
Instance Method Summary collapse
-
#initialize(file) ⇒ Data
constructor
A new instance of Data.
Constructor Details
#initialize(file) ⇒ Data
Returns a new instance of Data.
19 20 21 22 23 24 25 26 27 |
# File 'app/models/decidim/verifications/csv_census/data.rb', line 19 def initialize(file) @file = file @values = [] @errors = [] CSV.foreach(@file, encoding: "BOM|UTF-8") do |row| process_row(row) end end |
Instance Attribute Details
#errors ⇒ Object (readonly)
Returns the value of attribute errors.
17 18 19 |
# File 'app/models/decidim/verifications/csv_census/data.rb', line 17 def errors @errors end |
#values ⇒ Object (readonly)
Returns the value of attribute values.
17 18 19 |
# File 'app/models/decidim/verifications/csv_census/data.rb', line 17 def values @values end |