Class: RgGen::SpreadsheetLoader::Spreadsheet::Row
- Inherits:
-
Object
- Object
- RgGen::SpreadsheetLoader::Spreadsheet::Row
- Defined in:
- lib/rggen/spreadsheet_loader/spreadsheet/row.rb
Instance Attribute Summary collapse
-
#file ⇒ Object
readonly
Returns the value of attribute file.
-
#row ⇒ Object
readonly
Returns the value of attribute row.
-
#sheet ⇒ Object
readonly
Returns the value of attribute sheet.
Instance Method Summary collapse
- #[](column) ⇒ Object
- #[]=(column, value) ⇒ Object
- #cells(from = 0, length = nil) ⇒ Object
-
#initialize(sheet, row) ⇒ Row
constructor
A new instance of Row.
Constructor Details
#initialize(sheet, row) ⇒ Row
Returns a new instance of Row.
7 8 9 10 11 12 |
# File 'lib/rggen/spreadsheet_loader/spreadsheet/row.rb', line 7 def initialize(sheet, row) @file = sheet.file @sheet = sheet.sheet @row = row @cells = [] end |
Instance Attribute Details
#file ⇒ Object (readonly)
Returns the value of attribute file.
14 15 16 |
# File 'lib/rggen/spreadsheet_loader/spreadsheet/row.rb', line 14 def file @file end |
#row ⇒ Object (readonly)
Returns the value of attribute row.
16 17 18 |
# File 'lib/rggen/spreadsheet_loader/spreadsheet/row.rb', line 16 def row @row end |
#sheet ⇒ Object (readonly)
Returns the value of attribute sheet.
15 16 17 |
# File 'lib/rggen/spreadsheet_loader/spreadsheet/row.rb', line 15 def sheet @sheet end |
Instance Method Details
#[](column) ⇒ Object
18 19 20 21 |
# File 'lib/rggen/spreadsheet_loader/spreadsheet/row.rb', line 18 def [](column) @cells[column] ||= EmptyCell.new(self, column) @cells[column] end |
#[]=(column, value) ⇒ Object
23 24 25 |
# File 'lib/rggen/spreadsheet_loader/spreadsheet/row.rb', line 23 def []=(column, value) @cells[column] = Cell.new(value, self, column) end |
#cells(from = 0, length = nil) ⇒ Object
27 28 29 |
# File 'lib/rggen/spreadsheet_loader/spreadsheet/row.rb', line 27 def cells(from = 0, length = nil) Array.new(length || (@cells.size - from)) { |i| self[from + i] } end |