Class: Xlsxtream::Worksheet

Inherits:
Object
  • Object
show all
Defined in:
lib/xlsxtream/worksheet.rb

Instance Method Summary collapse

Constructor Details

#initialize(io, options = {}) ⇒ Worksheet

Returns a new instance of Worksheet.



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

def initialize(io, options = {})
  @io = io
  @rownum = 1
  @closed = false
  @options = options

  write_header
end

Instance Method Details

#<<(row) ⇒ Object Also known as: add_row



16
17
18
19
# File 'lib/xlsxtream/worksheet.rb', line 16

def <<(row)
  @io << Row.new(row, @rownum, @options).to_xml
  @rownum += 1
end

#closeObject



22
23
24
25
# File 'lib/xlsxtream/worksheet.rb', line 22

def close
  write_footer
  @closed = true
end

#closed?Boolean

Returns:

  • (Boolean)


27
28
29
# File 'lib/xlsxtream/worksheet.rb', line 27

def closed?
  @closed
end

#idObject



31
32
33
# File 'lib/xlsxtream/worksheet.rb', line 31

def id
  @options[:id]
end

#nameObject



35
36
37
# File 'lib/xlsxtream/worksheet.rb', line 35

def name
  @options[:name]
end