Class: Spreadsheetkit::Base
- Inherits:
-
Object
- Object
- Spreadsheetkit::Base
- Includes:
- StyleParser
- Defined in:
- lib/spreadsheetkit/base.rb
Instance Attribute Summary collapse
-
#html ⇒ Object
readonly
Returns the value of attribute html.
-
#sheets ⇒ Object
readonly
Returns the value of attribute sheets.
-
#xls ⇒ Object
readonly
Returns the value of attribute xls.
Instance Method Summary collapse
-
#initialize(html) ⇒ Base
constructor
A new instance of Base.
- #render ⇒ Object
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
#html ⇒ Object (readonly)
Returns the value of attribute html.
13 14 15 |
# File 'lib/spreadsheetkit/base.rb', line 13 def html @html end |
#sheets ⇒ Object (readonly)
Returns the value of attribute sheets.
13 14 15 |
# File 'lib/spreadsheetkit/base.rb', line 13 def sheets @sheets end |
#xls ⇒ Object (readonly)
Returns the value of attribute xls.
13 14 15 |
# File 'lib/spreadsheetkit/base.rb', line 13 def xls @xls end |
Instance Method Details
#render ⇒ Object
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 |