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
- .poll(**options, &block) ⇒ Object
- .poll_for(duration, **options, &block) ⇒ Object
- .poll_until(until_time, **options, &block) ⇒ Object
Class Method Details
.poll(**options, &block) ⇒ Object
7 8 9 10 11 |
# File 'lib/safe_poller.rb', line 7 def self.poll(**, &block) poller = SafePoller::Base.new(**, &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, **, &block) [:until] = Time.now + duration poll(**, &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, **, &block) [:until] = until_time poll(**, &block) end |