Class: Net::IRC::Mala
- Inherits:
-
AsyncSession
- Object
- AsyncSession
- Net::IRC::Mala
- Defined in:
- lib/net/irc/mala.rb
Instance Method Summary collapse
Instance Method Details
#main_channel ⇒ Object
40 41 42 |
# File 'lib/net/irc/mala.rb', line 40 def main_channel "#malastream" end |
#on_new_thread ⇒ Object
44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 |
# File 'lib/net/irc/mala.rb', line 44 def on_new_thread EM.run do api = "http://api.ma.la/home_timeline/stream" source = EventMachine::EventSource.new(api) source. do || begin status = JSON.parse() tweet = status["text"] screen_name = status['user']['screen_name'] post screen_name, PRIVMSG, main_channel, tweet rescue => ex STDERR.puts "error: #{ex.inspect}" next end end source.start # Start listening end end |
#server_name ⇒ Object
36 37 38 |
# File 'lib/net/irc/mala.rb', line 36 def server_name "malastream" end |