Sha256: d66c6448787d1ce4c56c2afe4d71ae78528b92f07ed7c9dd9455e1f18b5a21f3
Contents?: true
Size: 1.04 KB
Versions: 2
Compression:
Stored size: 1.04 KB
Contents
# frozen_string_literal: true module Ductr module SequelBase # # 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.3 | lib/ductr/sequel_base/polling_handler.rb |
ductr-0.2.2 | lib/ductr/sequel_base/polling_handler.rb |