Class: Timelog::Command::Active
- Inherits:
-
Timelog::Command
- Object
- Timelog::Command
- Timelog::Command::Active
- Defined in:
- lib/timelog/command/active.rb
Instance Attribute Summary
Attributes inherited from Timelog::Command
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
#execute ⇒ Object
4 5 6 7 8 9 10 11 12 13 |
# File 'lib/timelog/command/active.rb', line 4 def execute if entry = book.entries.active client = (entry.client and book.clients.exists?(entry.client)) ? book.clients.name(entry.client) : nil project = (client and entry.project and book.projects.exists?(client, entry.project)) ? book.projects.name(client, entry.project) : nil description = "%s%s" % [client || "n/a", project ? ": #{project}" : ""] "%s - %02d:%02d:%02d#{" (paused)" if entry.paused?}" % ([description] + entry.active_time.values) else "no active entry" end end |
#help ⇒ Object
15 16 17 |
# File 'lib/timelog/command/active.rb', line 15 def help "usage: timelog active" end |