Module: ElapsedWatch
- Defined in:
- lib/elapsed_watch.rb,
lib/elapsed_watch/event.rb,
lib/elapsed_watch/version.rb,
lib/elapsed_watch/event_collection.rb
Defined Under Namespace
Classes: Event, EventCollection
Constant Summary collapse
- PAST_EVENT_FORMAT =
The format for events occuring in the past
"%s %s ago"- FUTURE_EVENT_FORMAT =
The format for events occuring in the future
"%s in %s"- VERSION =
"0.0.1"- DESCRIPTION =
" Reading a file of events, containing an event name (a string) and a date-time string (yyyy-mm-dd hh:mm(:ss)), print a nice duration since the event (if the event occurs in the past) or until the event (if the event occurs in the future). The impetous for this little program is my wanting to know how long it has been since my last cigarette. "- SUMMARY =
"Print elapsed time since or until an event in nice human-readable form"- DEFAULT_EVENT_FILE =
File.join(ENV['HOME'],'.eventsrc')
Class Method Summary collapse
-
.run(event_file, options = {}) ⇒ Object
Module method that runs the elapsed watcher.
Class Method Details
.run(event_file, options = {}) ⇒ Object
Module method that runs the elapsed watcher
Inputs
-
event_file (string) - name of the event file, nil to use default
-
options (hash) - options from command line
Returns
Array of elapsed times for events
26 27 28 |
# File 'lib/elapsed_watch.rb', line 26 def self.run(event_file,={}) EventCollection.new(event_file).map(&:to_s) end |