Class: TrelloScrum::Spreadsheet
- Inherits:
-
Object
- Object
- TrelloScrum::Spreadsheet
- Defined in:
- lib/spreadsheet.rb
Instance Attribute Summary collapse
-
#package ⇒ Object
readonly
Returns the value of attribute package.
-
#workbook ⇒ Object
readonly
Returns the value of attribute workbook.
Instance Method Summary collapse
-
#initialize ⇒ Spreadsheet
constructor
A new instance of Spreadsheet.
- #render_cards(lists_with_cards) ⇒ Object
- #save(filename) ⇒ Object
Constructor Details
#initialize ⇒ Spreadsheet
Returns a new instance of Spreadsheet.
10 11 12 13 |
# File 'lib/spreadsheet.rb', line 10 def initialize @package = Axlsx::Package.new @workbook = @package.workbook end |
Instance Attribute Details
#package ⇒ Object (readonly)
Returns the value of attribute package.
8 9 10 |
# File 'lib/spreadsheet.rb', line 8 def package @package end |
#workbook ⇒ Object (readonly)
Returns the value of attribute workbook.
8 9 10 |
# File 'lib/spreadsheet.rb', line 8 def workbook @workbook end |
Instance Method Details
#render_cards(lists_with_cards) ⇒ Object
15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 |
# File 'lib/spreadsheet.rb', line 15 def render_cards(lists_with_cards) list_name_style = workbook.styles.add_style :sz => 16, :b => true header_style = workbook.styles.add_style :b => true workbook.add_worksheet(:name => "Cards") do |sheet| lists_with_cards.each do |list| # The list title sheet.add_row [ list[:list].name.to_s + (list[:list].closed ? " (archived)" : "") ], style: list_name_style # Header sheet.add_row [ "Points", "Title", "Client", "URL" ], style: header_style list[:cards].each do |card| sheet.add_row [ card.scrum_points, card.scrum_title, card.scrum_client, card.url ] end # Add some empty rows sheet.add_row end sheet.column_widths 10, nil, nil, nil end end |
#save(filename) ⇒ Object
51 52 53 |
# File 'lib/spreadsheet.rb', line 51 def save(filename) package.serialize(filename) end |