class TaskManager::Format
Attributes
task[R]
Public Class Methods
new(task)
click to toggle source
# File lib/task_manager/format.rb, line 5 def initialize(task) @task = task end
Public Instance Methods
created_at()
click to toggle source
# File lib/task_manager/format.rb, line 14 def created_at "created #{format_time(task.created_at)}" if task.created_at end
finished_at()
click to toggle source
# File lib/task_manager/format.rb, line 22 def finished_at " | finished #{format_time(task.finished_at)}" if task.finished_at end
format_time(time)
click to toggle source
# File lib/task_manager/format.rb, line 26 def format_time(time) time.strftime('%d %^b %Y') end
print_output()
click to toggle source
# File lib/task_manager/format.rb, line 9 def print_output $stdout.puts(" #{task.id}. #{task.name}".colorize(:light_yellow)) $stdout.puts(" #{created_at}#{started_at}#{finished_at}".colorize(:light_blue)) end
started_at()
click to toggle source
# File lib/task_manager/format.rb, line 18 def started_at " | started #{format_time(task.started_at)}" if task.started_at end