class WorkLogCli

Public Instance Methods

__print_version() click to toggle source
# File lib/work_log_cli.rb, line 73
def __print_version
  spec = Gem::Specification.load('myworklog.gemspec')
  puts spec.version
end
add(description) click to toggle source
# File lib/work_log_cli.rb, line 17
def add(description)
  date = options[:d] || 'today'
  WorkLogController.new.add_work_log(date, description)
rescue ArgumentError => e
  puts e
end
delete(id) click to toggle source
# File lib/work_log_cli.rb, line 64
def delete(id)
  WorkLogController.new.delete(id)
  puts "Work log with #{id} ID has been deleted!"
rescue ArgumentError => e
  puts e
end
list(date = '') click to toggle source
# File lib/work_log_cli.rb, line 56
def list(date = '')
  return print(WorkLogController.new.list_all) if options[:all]

  print(ListStrategy.new(date, options[:m], options[:y]).execute)
end

Private Instance Methods

list_by_month(month) click to toggle source
# File lib/work_log_cli.rb, line 84
def list_by_month(month)
  print(WorkLogController.new.find_by_month_and_year(month, Date.today.year))
end
list_by_month_and_year(month, year) click to toggle source
# File lib/work_log_cli.rb, line 88
def list_by_month_and_year(month, year)
  print(WorkLogController.new.find_by_month_and_year(month, year))
end
list_by_year(year) click to toggle source
# File lib/work_log_cli.rb, line 80
def list_by_year(year)
  print(WorkLogController.new.find_by_year(year))
end
print(work_log_list) click to toggle source