Class: Dibber::ProcessLog
- Inherits:
-
Object
- Object
- Dibber::ProcessLog
- Defined in:
- lib/dibber/process_log.rb
Instance Method Summary collapse
- #exists?(name) ⇒ Boolean
- #finish(name) ⇒ Object
-
#initialize ⇒ ProcessLog
constructor
A new instance of ProcessLog.
- #raw ⇒ Object
- #report ⇒ Object
- #start(name, command) ⇒ Object
Constructor Details
#initialize ⇒ ProcessLog
Returns a new instance of ProcessLog.
4 5 6 |
# File 'lib/dibber/process_log.rb', line 4 def initialize @log = {} end |
Instance Method Details
#exists?(name) ⇒ Boolean
32 33 34 |
# File 'lib/dibber/process_log.rb', line 32 def exists?(name) @log.keys.include?(name) end |
#finish(name) ⇒ Object
15 16 17 |
# File 'lib/dibber/process_log.rb', line 15 def finish(name) @log[name][:finish] = eval(@log[name][:command]) end |
#raw ⇒ Object
19 20 21 |
# File 'lib/dibber/process_log.rb', line 19 def raw @log end |
#report ⇒ Object
23 24 25 26 27 28 29 30 |
# File 'lib/dibber/process_log.rb', line 23 def report @report = [] @log.each do |name, log| finish(name) unless @log[name][:finish] @report << "#{name.to_s.capitalize.gsub(/_/, ' ')} was #{log[:start]}, now #{log[:finish]}." end return @report end |
#start(name, command) ⇒ Object
8 9 10 11 12 13 |
# File 'lib/dibber/process_log.rb', line 8 def start(name, command) @log[name] = { :start => eval(command), :command => command } end |