Sha256: 6d658aeab039c4a2a26d7281a4fe0c46ebae5a87a87f89b164afd02170dfb482

Contents?: true

Size: 679 Bytes

Versions: 8

Compression:

Stored size: 679 Bytes

Contents

module Clockwork

  module DatabaseEvents

    class Event < Clockwork::Event

      attr_accessor :event_store, :model_attributes

      def initialize(manager, period, job, block, event_store, model_attributes, options={})
        super(manager, period, job, block, options)
        @event_store = event_store
        @event_store.register(self, job)
        @model_attributes = model_attributes
      end

      def name
        (job_has_name? && job.name) ? job.name : "#{job.class}:#{job.id}"
      end

      def job_has_name?
        job.respond_to?(:name)
      end

      def to_s
        name
      end

      def frequency
        @period
      end
    end

  end
end

Version data entries

8 entries across 8 versions & 1 rubygems

Version Path
clockwork-3.0.2 lib/clockwork/database_events/event.rb
clockwork-3.0.1 lib/clockwork/database_events/event.rb
clockwork-3.0.0 lib/clockwork/database_events/event.rb
clockwork-2.0.4 lib/clockwork/database_events/event.rb
clockwork-2.0.3 lib/clockwork/database_events/event.rb
clockwork-2.0.2 lib/clockwork/database_events/event.rb
clockwork-2.0.1 lib/clockwork/database_events/event.rb
clockwork-2.0.0 lib/clockwork/database_events/event.rb