class SDEE::Client

Public Class Methods

new(options={}) click to toggle source
# File lib/sdee/client.rb, line 6
def initialize(options={})
  @options = options

  # buffer to retain alerts, threads
  @events = @threads = []
end

Public Instance Methods

get() click to toggle source

Retrieves but doesn’t remove events from buffer

# File lib/sdee/client.rb, line 36
def get
  @events
end
pop() click to toggle source

Removes events from buffer

# File lib/sdee/client.rb, line 31
def pop
  @events.delete
end
start_polling(num_threads=5) click to toggle source
# File lib/sdee/client.rb, line 13
def start_polling(num_threads=5)
  stop_polling unless @threads.empty?

  num_threads.times do
    @threads << Thread.new do
      poller = Poller.new(@options)
      poller.poll
    end
  end

  @threads.each { |t| t.join }
end
stop_polling() click to toggle source
# File lib/sdee/client.rb, line 26
def stop_polling
  @threads.each { |thread| thread.terminate }
end