Class: OOXML::Excel::Sheet::Row
- Inherits:
-
Object
- Object
- OOXML::Excel::Sheet::Row
- Defined in:
- lib/ooxml_excel/sheet.rb,
lib/ooxml_excel/sheet.rb
Defined Under Namespace
Classes: Cell
Instance Attribute Summary collapse
-
#cells ⇒ Object
Returns the value of attribute cells.
-
#id ⇒ Object
Returns the value of attribute id.
-
#spans ⇒ Object
Returns the value of attribute spans.
Class Method Summary collapse
Instance Method Summary collapse
- #[](id) ⇒ Object
-
#initialize(**attrs) ⇒ Row
constructor
A new instance of Row.
Constructor Details
#initialize(**attrs) ⇒ Row
Returns a new instance of Row.
137 138 139 |
# File 'lib/ooxml_excel/sheet.rb', line 137 def initialize(**attrs) attrs.each { |property, value| send("#{property}=", value)} end |
Instance Attribute Details
#cells ⇒ Object
Returns the value of attribute cells.
135 136 137 |
# File 'lib/ooxml_excel/sheet.rb', line 135 def cells @cells end |
#id ⇒ Object
Returns the value of attribute id.
135 136 137 |
# File 'lib/ooxml_excel/sheet.rb', line 135 def id @id end |
#spans ⇒ Object
Returns the value of attribute spans.
135 136 137 |
# File 'lib/ooxml_excel/sheet.rb', line 135 def spans @spans end |
Class Method Details
.load_from_node(row_node, shared_strings) ⇒ Object
149 150 151 152 153 |
# File 'lib/ooxml_excel/sheet.rb', line 149 def self.load_from_node(row_node, shared_strings) new(id: row_node.attributes["r"].try(:value), spans: row_node.attributes["spans"].try(:value), cells: row_node.xpath('c').map { |cell_node| Row::Cell.load_from_node(cell_node, shared_strings) } ) end |
Instance Method Details
#[](id) ⇒ Object
141 142 143 144 145 146 147 |
# File 'lib/ooxml_excel/sheet.rb', line 141 def [](id) if id.is_a?(String) cells.find { |row| row.id == id} else cells[id] end end |