File: manager.rb

package info (click to toggle)
ruby-clockwork 3.0.1-2
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 348 kB
  • sloc: ruby: 1,638; makefile: 4
file content (24 lines) | stat: -rw-r--r-- 633 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
module Clockwork

  module DatabaseEvents

    class Manager < Clockwork::Manager

      def unregister(event)
        @events.delete(event)
      end

      def register(period, job, block, options)
        @events << if options[:from_database]
          synchronizer = options.fetch(:synchronizer)
          model_attributes = options.fetch(:model_attributes)

          Clockwork::DatabaseEvents::Event.
            new(self, period, job, (block || handler), synchronizer, model_attributes, options)
        else
          Clockwork::Event.new(self, period, job, block || handler, options)
        end
      end
    end
  end
end