Class: XlsxWriter::Row

Inherits:
Object
  • Object
show all
Defined in:
lib/xlsx_writer/row.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(sheet, raw_cells, y) ⇒ Row

Returns a new instance of Row.



7
8
9
10
11
12
13
14
# File 'lib/xlsx_writer/row.rb', line 7

def initialize(sheet, raw_cells, y)
  @sheet = sheet
  @y = y
  @cells = []
  raw_cells.each_with_index do |cell, x|
    @cells << Cell.new(self, cell, x, y)
  end
end

Instance Attribute Details

#cellsObject (readonly)

Returns the value of attribute cells.



4
5
6
# File 'lib/xlsx_writer/row.rb', line 4

def cells
  @cells
end

#sheetObject (readonly)

Returns the value of attribute sheet.



3
4
5
# File 'lib/xlsx_writer/row.rb', line 3

def sheet
  @sheet
end

#yObject (readonly)

Returns the value of attribute y.



5
6
7
# File 'lib/xlsx_writer/row.rb', line 5

def y
  @y
end

Instance Method Details

#to_xmlObject



16
17
18
19
20
21
22
23
24
# File 'lib/xlsx_writer/row.rb', line 16

def to_xml
  ary = []
  ary << %{<row r="#{y}">}
  cells.each do |cell|
    ary << cell.to_xml
  end
  ary << %{</row>}
  ary.join
end