Class: CSVPlusPlus::Row
- Inherits:
-
Object
- Object
- CSVPlusPlus::Row
- Defined in:
- lib/csv_plus_plus/row.rb
Overview
A row of a template
Instance Attribute Summary collapse
-
#cells ⇒ Array<Cell>
readonly
The current value of cells.
-
#index ⇒ Integer
The index of this row.
-
#modifier ⇒ Modifier
readonly
The modifier to apply to all cells in this row.
Instance Method Summary collapse
-
#deep_clone ⇒ Row
Return a deep copy of this row.
-
#expand_amount ⇒ Integer
How much this row will expand itself, if at all (0).
-
#initialize(index, cells, modifier) ⇒ Row
constructor
A new instance of Row.
- #to_s ⇒ String
Constructor Details
#initialize(index, cells, modifier) ⇒ Row
Returns a new instance of Row.
15 16 17 18 19 |
# File 'lib/csv_plus_plus/row.rb', line 15 def initialize(index, cells, modifier) @cells = cells @modifier = modifier @index = index end |
Instance Attribute Details
#cells ⇒ Array<Cell> (readonly)
Returns the current value of cells.
9 10 11 |
# File 'lib/csv_plus_plus/row.rb', line 9 def cells @cells end |
#index ⇒ Integer
The index of this row
9 10 11 |
# File 'lib/csv_plus_plus/row.rb', line 9 def index @index end |
#modifier ⇒ Modifier (readonly)
The modifier to apply to all cells in this row
9 10 11 |
# File 'lib/csv_plus_plus/row.rb', line 9 def modifier @modifier end |
Instance Method Details
#deep_clone ⇒ Row
Return a deep copy of this row
46 47 48 |
# File 'lib/csv_plus_plus/row.rb', line 46 def deep_clone ::Marshal.load(::Marshal.dump(self)) end |
#expand_amount ⇒ Integer
How much this row will expand itself, if at all (0)
32 33 34 35 36 |
# File 'lib/csv_plus_plus/row.rb', line 32 def return 0 unless @modifier. @modifier..repetitions || (1000 - @index) end |
#to_s ⇒ String
39 40 41 |
# File 'lib/csv_plus_plus/row.rb', line 39 def to_s "Row(index: #{index}, modifier: #{modifier}, cells: #{cells})" end |