Class: Pello::Board
- Inherits:
-
Object
- Object
- Pello::Board
- Extended by:
- Forwardable
- Defined in:
- lib/pello/board.rb
Instance Attribute Summary collapse
-
#trello_board ⇒ Object
Returns the value of attribute trello_board.
Instance Method Summary collapse
- #as_table ⇒ Object
-
#initialize(trello_board) ⇒ Board
constructor
A new instance of Board.
Constructor Details
#initialize(trello_board) ⇒ Board
Returns a new instance of Board.
10 11 12 |
# File 'lib/pello/board.rb', line 10 def initialize(trello_board) @trello_board = trello_board end |
Instance Attribute Details
#trello_board ⇒ Object
Returns the value of attribute trello_board.
7 8 9 |
# File 'lib/pello/board.rb', line 7 def trello_board @trello_board end |
Instance Method Details
#as_table ⇒ Object
14 15 16 17 18 19 20 21 22 23 24 25 |
# File 'lib/pello/board.rb', line 14 def as_table headers = trello_board.lists.map(&:name) cards = trello_board.lists.map { |list| list.cards.map { |card| truncate(card.name, 45) } } max_cards = cards.map(&:length).max cards = cards.map { |list_cards| list_cards + [nil] * (max_cards - list_cards.length) } tableized_cards = cards.transpose table = TTY::Table.new headers, tableized_cards table.render :unicode, multiline: true, resize: true, padding: [0, 0, 1, 0] end |