Class: Decidim::Verifications::CsvCensus::Data

Inherits:
Object
  • Object
show all
Defined in:
decidim-verifications/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 readed from the csv file

Returns nothing

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(file) ⇒ Data

Returns a new instance of Data.


19
20
21
22
23
24
25
26
27
# File 'decidim-verifications/app/models/decidim/verifications/csv_census/data.rb', line 19

def initialize(file)
  @file = file
  @values = []
  @errors = []

  CSV.foreach(@file) do |row|
    process_row(row)
  end
end

Instance Attribute Details

#errorsObject (readonly)

Returns the value of attribute errors


17
18
19
# File 'decidim-verifications/app/models/decidim/verifications/csv_census/data.rb', line 17

def errors
  @errors
end

#valuesObject (readonly)

Returns the value of attribute values


17
18
19
# File 'decidim-verifications/app/models/decidim/verifications/csv_census/data.rb', line 17

def values
  @values
end