Sha256: 833a525f3d5e7c12c71867d269fd7979addbbbaef7f60fd510d5e8e7e213114e
Contents?: true
Size: 1.03 KB
Versions: 2
Compression:
Stored size: 1.03 KB
Contents
# frozen_string_literal: true module Ductr module Sequel # # The rufus-scheduler handler class. # @see https://github.com/jmettraux/rufus-scheduler#scheduling-handler-instances # For further information # class PollingHandler # # Creates the handler based on the given scheduler, its method name and the trigger's adapter instance. # # @param [Method] method The scheduler's method # @param [Ductr::Adapter] adapter The trigger's adapter # def initialize(method, adapter) @method = method @adapter = adapter @last_triggering_key = nil end # # The callable method used by the trigger, actually calls the scheduler's method. # # @return [void] # def call @adapter.open do |db| @method.call(db) do |triggering_key| return false if triggering_key == @last_triggering_key @last_triggering_key = triggering_key true end end end end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
ductr-0.2.1 | lib/ductr/sequel/polling_handler.rb |
ductr-0.2.0 | lib/ductr/sequel/polling_handler.rb |