Class: Nico::Listener
- Inherits:
-
Object
- Object
- Nico::Listener
- Defined in:
- lib/nico/room/listener.rb
Instance Method Summary collapse
- #each ⇒ Object
-
#initialize(id, token) ⇒ Listener
constructor
A new instance of Listener.
Constructor Details
#initialize(id, token) ⇒ Listener
Returns a new instance of Listener.
6 7 8 |
# File 'lib/nico/room/listener.rb', line 6 def initialize(id, token) @url = "http://#{token}:[email protected]/room/#{id}/live.json" end |
Instance Method Details
#each ⇒ Object
10 11 12 13 14 |
# File 'lib/nico/room/listener.rb', line 10 def each Yajl::HttpStream.get(URI.parse @url) do |json| yield Message.new(json) end end |