Sha256: 7c6b2f38079d6ffe007fcbbdbf13b4453f70466c84f5c28d9aa6ac678cddf5ec

Contents?: true

Size: 648 Bytes

Versions: 6

Compression:

Stored size: 648 Bytes

Contents

module Dibber
  class ProcessLog

    def initialize
      @log = {}
    end

    def start(name, command)
      @log[name] = {
        :start => eval(command),
        :command => command
      }
    end

    def finish(name)
      @log[name][:finish] = eval(@log[name][:command])
    end

    def raw
      @log
    end

    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

    def exists?(name)
      @log.keys.include?(name)
    end

  end
end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
dibber-0.7.0 lib/dibber/process_log.rb
dibber-0.6.0 lib/dibber/process_log.rb
dibber-0.5.0 lib/dibber/process_log.rb
dibber-0.4.0 lib/dibber/process_log.rb
dibber-0.3.1 lib/dibber/process_log.rb
dibber-0.3.0 lib/dibber/process_log.rb