Module: SafePoller

Defined in:
lib/safe_poller.rb,
lib/safe_poller/base.rb,
lib/safe_poller/version.rb

Defined Under Namespace

Classes: Base

Constant Summary collapse

VERSION =
'0.0.1'

Class Method Summary collapse

Class Method Details

.poll(**options, &block) ⇒ Object



7
8
9
10
11
# File 'lib/safe_poller.rb', line 7

def self.poll(**options, &block)
  poller = SafePoller::Base.new(**options, &block)
  poller.start
  poller
end

.poll_for(duration, **options, &block) ⇒ Object



18
19
20
21
# File 'lib/safe_poller.rb', line 18

def self.poll_for(duration, **options, &block)
  options[:until] = Time.now + duration
  poll(**options, &block)
end

.poll_until(until_time, **options, &block) ⇒ Object



13
14
15
16
# File 'lib/safe_poller.rb', line 13

def self.poll_until(until_time, **options, &block)
  options[:until] = until_time
  poll(**options, &block)
end