Sha256: bdb52cd301ab56824d46eea25e2a5281bec44877a4ee4b8f71108a07d3f7c500

Contents?: true

Size: 612 Bytes

Versions: 1

Compression:

Stored size: 612 Bytes

Contents

module Clockworkd
  class Event
   attr_accessor :job, :block, :cronline, :cron_time, :next_time

    def initialize(job, block, cronline)
      @job = job
      @block = block
      @cronline = cronline
      @cron_time = CronLine.new(@cronline)
      @next_time = @cron_time.next_time
    end

    def to_s
      @job = job
    end

    def time?(t)
      if (t.to_i - @next_time.to_i) > 0
        @next_time = @cron_time.next_time
        return true
      end
      false
    end

    def run(t)
      eval(@block)
    rescue Exception => e
      raise e
    end

  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
clockworkd-0.2.5 lib/clockworkd/event.rb