Class: XlsxWriter::Row
- Inherits:
-
Object
- Object
- XlsxWriter::Row
- Defined in:
- lib/xlsx_writer/row.rb
Instance Attribute Summary collapse
-
#cells ⇒ Object
readonly
Returns the value of attribute cells.
-
#sheet ⇒ Object
readonly
Returns the value of attribute sheet.
-
#width ⇒ Object
readonly
Returns the value of attribute width.
Instance Method Summary collapse
- #cell_width(x) ⇒ Object
-
#initialize(sheet, columns) ⇒ Row
constructor
A new instance of Row.
- #length ⇒ Object
- #ndx ⇒ Object
- #to_xml ⇒ Object
Constructor Details
Instance Attribute Details
#cells ⇒ Object (readonly)
Returns the value of attribute cells.
4 5 6 |
# File 'lib/xlsx_writer/row.rb', line 4 def cells @cells end |
#sheet ⇒ Object (readonly)
Returns the value of attribute sheet.
3 4 5 |
# File 'lib/xlsx_writer/row.rb', line 3 def sheet @sheet end |
#width ⇒ Object (readonly)
Returns the value of attribute width.
5 6 7 |
# File 'lib/xlsx_writer/row.rb', line 5 def width @width end |
Instance Method Details
#cell_width(x) ⇒ Object
23 24 25 26 27 28 29 |
# File 'lib/xlsx_writer/row.rb', line 23 def cell_width(x) @width[x] ||= if (cell = cells[x]) cell.pixel_width else 0 end end |
#length ⇒ Object
19 20 21 |
# File 'lib/xlsx_writer/row.rb', line 19 def length cells.length end |
#ndx ⇒ Object
15 16 17 |
# File 'lib/xlsx_writer/row.rb', line 15 def ndx sheet.rows.index(self) + 1 end |
#to_xml ⇒ Object
31 32 33 34 35 36 37 38 39 |
# File 'lib/xlsx_writer/row.rb', line 31 def to_xml ary = [] ary << %{<row r="#{ndx}">} cells.each do |cell| ary << cell.to_xml end ary << %{</row>} ary.join end |