Class: Tdoo::Format::Pretty
- Inherits:
-
Object
- Object
- Tdoo::Format::Pretty
- Defined in:
- lib/tdoo/format/pretty.rb
Instance Method Summary collapse
- #after ⇒ Object
- #format_done(project, index, task, created, completed) ⇒ Object
- #format_todo(project, index, task, created) ⇒ Object
-
#initialize ⇒ Pretty
constructor
A new instance of Pretty.
Constructor Details
#initialize ⇒ Pretty
Returns a new instance of Pretty.
8 9 10 |
# File 'lib/tdoo/format/pretty.rb', line 8 def initialize @table = Terminal::Table.new headings: %w(project id name created completed) end |
Instance Method Details
#after ⇒ Object
32 33 34 |
# File 'lib/tdoo/format/pretty.rb', line 32 def after puts @table.to_s end |
#format_done(project, index, task, created, completed) ⇒ Object
22 23 24 25 26 27 28 29 30 |
# File 'lib/tdoo/format/pretty.rb', line 22 def format_done(project, index, task, created, completed) row = [] row << project.color(:blue) row << index row << task.color(:green) row << as_date(created).color(:green) row << as_date(completed).color(:green) @table << row end |
#format_todo(project, index, task, created) ⇒ Object
12 13 14 15 16 17 18 19 20 |
# File 'lib/tdoo/format/pretty.rb', line 12 def format_todo(project, index, task, created) row = [] row << project.color(:blue) row << index row << task.color(:red) row << as_date(created).color(:red) row << '' @table << row end |