Class: Spreadsheetkit::Sheet
- Inherits:
-
Object
- Object
- Spreadsheetkit::Sheet
- Defined in:
- lib/spreadsheetkit/sheet.rb
Instance Attribute Summary collapse
-
#rows ⇒ Object
Returns the value of attribute rows.
-
#sheet ⇒ Object
Returns the value of attribute sheet.
-
#table ⇒ Object
Returns the value of attribute table.
-
#title ⇒ Object
Returns the value of attribute title.
Instance Method Summary collapse
-
#initialize(table, options = {}) ⇒ Sheet
constructor
A new instance of Sheet.
- #render(xls) ⇒ Object
Constructor Details
#initialize(table, options = {}) ⇒ Sheet
Returns a new instance of Sheet.
6 7 8 9 10 11 12 |
# File 'lib/spreadsheetkit/sheet.rb', line 6 def initialize(table, = {}) @table = table @rows = [] @table.css("tr").each{ |tr| @rows << Spreadsheetkit::Row.new(tr) } @title = @table[:title] end |
Instance Attribute Details
#rows ⇒ Object
Returns the value of attribute rows.
4 5 6 |
# File 'lib/spreadsheetkit/sheet.rb', line 4 def rows @rows end |
#sheet ⇒ Object
Returns the value of attribute sheet.
4 5 6 |
# File 'lib/spreadsheetkit/sheet.rb', line 4 def sheet @sheet end |
#table ⇒ Object
Returns the value of attribute table.
4 5 6 |
# File 'lib/spreadsheetkit/sheet.rb', line 4 def table @table end |
#title ⇒ Object
Returns the value of attribute title.
4 5 6 |
# File 'lib/spreadsheetkit/sheet.rb', line 4 def title @title end |
Instance Method Details
#render(xls) ⇒ Object
14 15 16 17 18 19 20 21 |
# File 'lib/spreadsheetkit/sheet.rb', line 14 def render(xls) @sheet = xls.create_worksheet @sheet.name = @title unless @title.blank? @rows.each_with_index do |row, row_x| row.render @sheet.row(row_x) end end |