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 ⇒ Object
readonly
Returns the value of attribute cells.
-
#index ⇒ Object
Returns the value of attribute index.
-
#modifier ⇒ Object
readonly
Returns the value of attribute modifier.
Instance Method Summary collapse
-
#deep_clone ⇒ Object
Return a deep copy of this row.
-
#expand_amount ⇒ Object
How much this row will expand itself, if at all (0).
-
#initialize(index, cells, modifier) ⇒ Row
constructor
initialize.
-
#to_s ⇒ Object
to_s.
Constructor Details
#initialize(index, cells, modifier) ⇒ Row
initialize
13 14 15 16 17 |
# File 'lib/csv_plus_plus/row.rb', line 13 def initialize(index, cells, modifier) @cells = cells @modifier = modifier @index = index end |
Instance Attribute Details
#cells ⇒ Object (readonly)
Returns the value of attribute cells.
10 11 12 |
# File 'lib/csv_plus_plus/row.rb', line 10 def cells @cells end |
#index ⇒ Object
Returns the value of attribute index.
10 11 12 |
# File 'lib/csv_plus_plus/row.rb', line 10 def index @index end |
#modifier ⇒ Object (readonly)
Returns the value of attribute modifier.
10 11 12 |
# File 'lib/csv_plus_plus/row.rb', line 10 def modifier @modifier end |
Instance Method Details
#deep_clone ⇒ Object
Return a deep copy of this row
38 39 40 |
# File 'lib/csv_plus_plus/row.rb', line 38 def deep_clone ::Marshal.load(::Marshal.dump(self)) end |
#expand_amount ⇒ Object
How much this row will expand itself, if at all (0)
26 27 28 29 30 |
# File 'lib/csv_plus_plus/row.rb', line 26 def return 0 unless @modifier. @modifier..repetitions || (1000 - @index) end |
#to_s ⇒ Object
to_s
33 34 35 |
# File 'lib/csv_plus_plus/row.rb', line 33 def to_s "Row(index: #{index}, modifier: #{modifier}, cells: #{cells})" end |