Class: ExcelAbstraction::CellRange
- Inherits:
-
Object
- Object
- ExcelAbstraction::CellRange
- Includes:
- Enumerable
- Defined in:
- lib/excel_templating/excel_abstraction/cell_range.rb
Instance Attribute Summary collapse
-
#cell_references ⇒ Object
readonly
protected
Returns the value of attribute cell_references.
Instance Method Summary collapse
- #<<(attrs) ⇒ Object
- #each(&block) ⇒ Object
-
#initialize ⇒ CellRange
constructor
A new instance of CellRange.
Constructor Details
#initialize ⇒ CellRange
Returns a new instance of CellRange.
8 9 10 |
# File 'lib/excel_templating/excel_abstraction/cell_range.rb', line 8 def initialize @cell_references = [] end |
Instance Attribute Details
#cell_references ⇒ Object (readonly, protected)
Returns the value of attribute cell_references.
24 25 26 |
# File 'lib/excel_templating/excel_abstraction/cell_range.rb', line 24 def cell_references @cell_references end |
Instance Method Details
#<<(attrs) ⇒ Object
16 17 18 19 20 |
# File 'lib/excel_templating/excel_abstraction/cell_range.rb', line 16 def <<(attrs) cell_reference = ExcelAbstraction::CellReference.new(attrs) raise(ArgumentError, "Must be a CellReference belonging to the same row") if last && last.row != cell_reference.row self.cell_references << cell_reference end |
#each(&block) ⇒ Object
12 13 14 |
# File 'lib/excel_templating/excel_abstraction/cell_range.rb', line 12 def each(&block) cell_references.each { |cell_reference| yield(cell_reference) } end |