Class: Poundie::Runner

Inherits:
Object
  • Object
show all
Defined in:
lib/poundie/runner.rb

Constant Summary collapse

CONFIG_FILE =
File.join(ENV["HOME"], ".poundie_")

Instance Method Summary collapse

Constructor Details

#initialize(name) ⇒ Runner

Returns a new instance of Runner.



5
6
7
8
# File 'lib/poundie/runner.rb', line 5

def initialize(name)
  @name = name
  configure
end

Instance Method Details

#run ⇒ Object



10
11
12
13
14
15
16
17
18
19
20
# File 'lib/poundie/runner.rb', line 10

def run
  room.join # We need to make sure we're in the room first
  Yajl::HttpStream.get(room_uri, :symbolize_keys => true) do |message|
    Thread.new do
      plugins.each { |plugin| plugin.call(message) }
    end
  end
  puts "Connection lost. Reconnecting..."
  sleep 3
  run
end