Class: Osheet::XmlssWriter::Base

Inherits:
Object
  • Object
show all
Includes:
Elements, Styles
Defined in:
lib/osheet/xmlss_writer/base.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(opts = {}) ⇒ Base

Returns a new instance of Base.



14
15
16
17
18
19
20
21
# File 'lib/osheet/xmlss_writer/base.rb', line 14

def initialize(opts={})
  @used_xstyles = []
  self.oworkbook =  if opts.has_key?(:workbook)
    opts[:workbook]
  else
    ::Osheet::Workbook.new
  end
end

Instance Attribute Details

#used_xstylesObject (readonly)

Returns the value of attribute used_xstyles.



12
13
14
# File 'lib/osheet/xmlss_writer/base.rb', line 12

def used_xstyles
  @used_xstyles
end

Instance Method Details

#oworkbook=(value) ⇒ Object



34
35
36
37
38
39
# File 'lib/osheet/xmlss_writer/base.rb', line 34

def oworkbook=(value)
  unless value.kind_of?(::Osheet::Workbook)
    raise ArgumentError, "'#{value.inspect}' is not an Osheet::Workbook"
  end
  @oworkbook = value
end

#to_data(xmlss_output_opts = {}) ⇒ Object



23
24
25
# File 'lib/osheet/xmlss_writer/base.rb', line 23

def to_data(xmlss_output_opts={})
  self.xworkbook(xmlss_output_opts).to_s
end

#to_file(file_path, xmlss_output_opts = {}) ⇒ Object



27
28
29
# File 'lib/osheet/xmlss_writer/base.rb', line 27

def to_file(file_path, xmlss_output_opts={})
  self.xworkbook(xmlss_output_opts).to_file(file_path)
end

#xworkbook(xmlss_output_opts = {}) ⇒ Object



41
42
43
44
45
46
# File 'lib/osheet/xmlss_writer/base.rb', line 41

def xworkbook(xmlss_output_opts={})
  @used_xstyles = []
  ::Xmlss::Workbook.new(:output => xmlss_output_opts).tap do |xwkbk|
    @oworkbook.worksheets.each { |sheet| worksheet(xwkbk, sheet) }
  end
end