Class: Ods::Row

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

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(content, sheet) ⇒ Row

Returns a new instance of Row.



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

def initialize(content, sheet)
  @content = content
  @sheet = sheet
end

Instance Attribute Details

#contentObject (readonly)

Returns the value of attribute content.



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

def content
  @content
end

#sheetObject (readonly)

Returns the value of attribute sheet.



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

def sheet
  @sheet
end

Instance Method Details

#colsObject



10
11
12
13
14
15
16
17
18
19
20
21
# File 'lib/ods/row.rb', line 10

def cols
  return @cols if @cols
  @cols = []
  content.xpath('table:table-cell').each do |node|
    repeat = node['table:number-columns-repeated'] || 1
    a_cell = Cell.new(node, self)
    repeat.to_i.times do
      @cols << a_cell
    end
  end
  @cols
end