Class: SampleManifestExcel::Upload::Rows
- Inherits:
-
Object
- Object
- SampleManifestExcel::Upload::Rows
- Includes:
- ActiveModel::Model, Enumerable
- Defined in:
- app/sample_manifest_excel/sample_manifest_excel/upload/rows.rb
Overview
A collection of Rows which relates to the data section of an uploaded spreadsheet Rows are valid if all of the rows are valid Expects an Upload::Data object.
Instance Attribute Summary collapse
-
#columns ⇒ Object
readonly
Returns the value of attribute columns.
-
#data ⇒ Object
readonly
Returns the value of attribute data.
-
#items ⇒ Object
readonly
Returns the value of attribute items.
-
#plate_metadata ⇒ Object
readonly
Returns the value of attribute plate_metadata.
Instance Method Summary collapse
-
#data_at(row_num) ⇒ Object
Return values for rows for a particular column number there is a similar method data#column(n), but it returns column of data for all rows (including empty ones).
- #each ⇒ Object
-
#initialize(data, columns, cache = SampleManifestAsset) ⇒ Rows
constructor
A new instance of Rows.
Constructor Details
#initialize(data, columns, cache = SampleManifestAsset) ⇒ Rows
Returns a new instance of Rows.
20 21 22 23 24 |
# File 'app/sample_manifest_excel/sample_manifest_excel/upload/rows.rb', line 20 def initialize(data, columns, cache = SampleManifestAsset) @data = data || [] @columns = columns @items = create_rows(cache) end |
Instance Attribute Details
#columns ⇒ Object (readonly)
Returns the value of attribute columns.
13 14 15 |
# File 'app/sample_manifest_excel/sample_manifest_excel/upload/rows.rb', line 13 def columns @columns end |
#data ⇒ Object (readonly)
Returns the value of attribute data.
13 14 15 |
# File 'app/sample_manifest_excel/sample_manifest_excel/upload/rows.rb', line 13 def data @data end |
#items ⇒ Object (readonly)
Returns the value of attribute items.
13 14 15 |
# File 'app/sample_manifest_excel/sample_manifest_excel/upload/rows.rb', line 13 def items @items end |
#plate_metadata ⇒ Object (readonly)
Returns the value of attribute plate_metadata.
13 14 15 |
# File 'app/sample_manifest_excel/sample_manifest_excel/upload/rows.rb', line 13 def @plate_metadata end |
Instance Method Details
#data_at(row_num) ⇒ Object
Return values for rows for a particular column number there is a similar method data#column(n), but it returns column of data for all rows (including empty ones)
32 33 34 |
# File 'app/sample_manifest_excel/sample_manifest_excel/upload/rows.rb', line 32 def data_at(row_num) map { |row| row.at(row_num) } end |
#each ⇒ Object
26 27 28 |
# File 'app/sample_manifest_excel/sample_manifest_excel/upload/rows.rb', line 26 def each(&) items.each(&) end |