Class: Timelog::Command::Stop

Inherits:
Timelog::Command show all
Defined in:
lib/timelog/command/stop.rb

Instance Attribute Summary

Attributes inherited from Timelog::Command

#arguments, #book, #session

Instance Method Summary collapse

Methods inherited from Timelog::Command

get, inherited, #initialize, known, register, #time_in_arguments

Constructor Details

This class inherits a constructor from Timelog::Command

Instance Method Details

#executeObject



4
5
6
7
8
9
10
11
12
# File 'lib/timelog/command/stop.rb', line 4

def execute
  time = time_in_arguments

  entry = book.entries.active_or_new
  entry.description = arguments.join(" ")

  book.entries.stop entry, at: time
  "entry stopped"
end

#helpObject



14
15
16
# File 'lib/timelog/command/stop.rb', line 14

def help
  "usage: timelog stop [<description>] [<time>]"
end