Class: Ductr::SQLite::PollingHandler
- Inherits:
-
Object
- Object
- Ductr::SQLite::PollingHandler
- Defined in:
- lib/ductr/sqlite/polling_handler.rb
Overview
The rufus-scheduler handler class.
Instance Method Summary collapse
-
#call ⇒ void
The callable method used by the trigger, actually calls the scheduler's method.
-
#initialize(method, adapter) ⇒ PollingHandler
constructor
Creates the handler based on the given scheduler, its method name and the trigger's adapter instance.
Constructor Details
#initialize(method, adapter) ⇒ PollingHandler
Creates the handler based on the given scheduler, its method name and the trigger's adapter instance.
17 18 19 20 21 |
# File 'lib/ductr/sqlite/polling_handler.rb', line 17 def initialize(method, adapter) @method = method @adapter = adapter @last_triggering_key = nil end |
Instance Method Details
#call ⇒ void
This method returns an undefined value.
The callable method used by the trigger, actually calls the scheduler's method.
28 29 30 31 32 33 34 35 36 37 |
# File 'lib/ductr/sqlite/polling_handler.rb', line 28 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 |