Class: Cryptsy::ConfirmationPoller

Inherits:
Object
  • Object
show all
Defined in:
lib/cryptsy/confirmation_poller.rb

Instance Method Summary collapse

Constructor Details

#initialize(adapter, pattern) ⇒ ConfirmationPoller



7
8
9
10
# File 'lib/cryptsy/confirmation_poller.rb', line 7

def initialize(adapter, pattern)
  @adapter = adapter
  @pattern = pattern
end

Instance Method Details

#run_onceEnumerable



13
14
15
16
17
18
19
20
21
# File 'lib/cryptsy/confirmation_poller.rb', line 13

def run_once
  links = []

  @adapter.call do |email|
    scan_links(links, email)
  end

  links
end

#run_until_found(sleep_interval = 3) ⇒ void



25
26
27
28
29
30
31
# File 'lib/cryptsy/confirmation_poller.rb', line 25

def run_until_found(sleep_interval = 3)
  loop do
    links = run_once
    return links unless links.empty?
    sleep sleep_interval
  end
end