Class: Spreadsheetkit::Base

Inherits:
Object
  • Object
show all
Includes:
StyleParser
Defined in:
lib/spreadsheetkit/base.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods included from StyleParser

#absolutize_image_sources, #absolutize_url, #css_parser, #parse_html, #update_image_urls

Constructor Details

#initialize(html) ⇒ Base

Returns a new instance of Base.



15
16
17
18
19
20
21
22
# File 'lib/spreadsheetkit/base.rb', line 15

def initialize(html)
  @html = parse_html(Nokogiri::HTML(html))
  
  @sheets = []
  @html.css("table").each do |table|
    @sheets << Spreadsheetkit::Sheet.new(table)
  end
end

Instance Attribute Details

#htmlObject (readonly)

Returns the value of attribute html.



13
14
15
# File 'lib/spreadsheetkit/base.rb', line 13

def html
  @html
end

#sheetsObject (readonly)

Returns the value of attribute sheets.



13
14
15
# File 'lib/spreadsheetkit/base.rb', line 13

def sheets
  @sheets
end

#xlsObject (readonly)

Returns the value of attribute xls.



13
14
15
# File 'lib/spreadsheetkit/base.rb', line 13

def xls
  @xls
end

Instance Method Details

#renderObject



24
25
26
27
28
29
# File 'lib/spreadsheetkit/base.rb', line 24

def render
  sio = StringIO.new
  compile_xls
  xls.write(sio)
  sio.string
end