Sha256: 7b0071bbb07515419d30d46f601d525d69cc6d4dac645e6c85f23c9a273e0554

Contents?: true

Size: 547 Bytes

Versions: 3

Compression:

Stored size: 547 Bytes

Contents

require 'nico/room/listener'
require 'nico/room/responder'

module Nico
  class Room
    def initialize(options = {})
      @requests = Listener.new options[:room_id], options[:token]
      @responses = Responder.new options[:subdomain], options[:room_id], options[:token]
    end

    def listen
      @requests.each{|request| yield self, request}
    end

    def each_message
      @requests.each{|request| yield request.body}
    end

    def respond_with(response)
      @responses.push response
    end
    alias :say :respond_with
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
nico-0.1.1 lib/nico/room.rb
nico-0.1.0 lib/nico/room.rb
nico-0.0.2 lib/nico/room.rb