class Tlog::Command::Points
Public Instance Methods
description()
click to toggle source
# File lib/tlog/command/points.rb, line 8 def description "changes the point value of the checked-out time log" end
execute(input, output)
click to toggle source
# File lib/tlog/command/points.rb, line 12 def execute(input, output) new_points_value = input.args[0] updated_log = change_state(new_points_value) output.line("Changed points of '#{updated_log.name}' to #{new_points_value}") end
name()
click to toggle source
# File lib/tlog/command/points.rb, line 4 def name "points" end
options(parser, options)
click to toggle source
# File lib/tlog/command/points.rb, line 18 def options(parser, options) parser.banner = "usage: tlog points <new_points_value>" end
Private Instance Methods
change_state(points)
click to toggle source
# File lib/tlog/command/points.rb, line 24 def change_state(points) storage.in_branch do |wd| checked_out_log = storage.checkout_value raise Tlog::Error::CheckoutInvalid, "No time log is checked out" unless checked_out_log log = storage.require_log(checked_out_log) raise Tlog::Error::TimeLogNotFound, "Time log '#{checked_out_log}' does not exist" unless log storage.change_log_points(log, points) log end end