Class: RailsSpreadsheetReader::RowCollection
- Inherits:
-
Object
- Object
- RailsSpreadsheetReader::RowCollection
- Defined in:
- lib/rails_spreadsheet_reader/row_collection.rb
Instance Attribute Summary collapse
-
#invalid_row ⇒ Object
Returns the value of attribute invalid_row.
-
#rows ⇒ Object
Returns the value of attribute rows.
Instance Method Summary collapse
- #<<(row) ⇒ Object
- #count ⇒ Object
- #each(&block) ⇒ Object
- #errors ⇒ Object
-
#initialize ⇒ RowCollection
constructor
A new instance of RowCollection.
- #invalid? ⇒ Boolean
- #valid? ⇒ Boolean
Constructor Details
#initialize ⇒ RowCollection
7 8 9 |
# File 'lib/rails_spreadsheet_reader/row_collection.rb', line 7 def initialize self.rows = [] end |
Instance Attribute Details
#invalid_row ⇒ Object
Returns the value of attribute invalid_row.
5 6 7 |
# File 'lib/rails_spreadsheet_reader/row_collection.rb', line 5 def invalid_row @invalid_row end |
#rows ⇒ Object
Returns the value of attribute rows.
5 6 7 |
# File 'lib/rails_spreadsheet_reader/row_collection.rb', line 5 def rows @rows end |
Instance Method Details
#<<(row) ⇒ Object
11 12 13 |
# File 'lib/rails_spreadsheet_reader/row_collection.rb', line 11 def <<(row) self.rows << row end |
#count ⇒ Object
39 40 41 |
# File 'lib/rails_spreadsheet_reader/row_collection.rb', line 39 def count self.rows.count end |
#each(&block) ⇒ Object
35 36 37 |
# File 'lib/rails_spreadsheet_reader/row_collection.rb', line 35 def each(&block) self.rows.each(&block) end |
#errors ⇒ Object
31 32 33 |
# File 'lib/rails_spreadsheet_reader/row_collection.rb', line 31 def errors invalid? ? self.invalid_row.errors : [] end |
#invalid? ⇒ Boolean
27 28 29 |
# File 'lib/rails_spreadsheet_reader/row_collection.rb', line 27 def invalid? !valid? end |
#valid? ⇒ Boolean
15 16 17 18 19 20 21 22 23 24 25 |
# File 'lib/rails_spreadsheet_reader/row_collection.rb', line 15 def valid? valid = true rows.each do |row| if row.invalid? self.invalid_row = row valid = false break end end valid end |