Class: Jebanni::RequestHandler::Processor
- Inherits:
-
Object
- Object
- Jebanni::RequestHandler::Processor
- Extended by:
- Forwardable
- Defined in:
- lib/jebanni/request_handler/processor.rb
Instance Attribute Summary collapse
-
#params ⇒ Object
Returns the value of attribute params.
Instance Method Summary collapse
- #channel ⇒ Object
- #channel_id(id) ⇒ Object
- #finish! ⇒ Object
- #finished? ⇒ Boolean
-
#initialize(request_handler) ⇒ Processor
constructor
A new instance of Processor.
- #on_first_connect(&block) ⇒ Object
- #response ⇒ Object
- #route=(found_route) ⇒ Object
- #settings ⇒ Object
Constructor Details
#initialize(request_handler) ⇒ Processor
Returns a new instance of Processor.
14 15 16 |
# File 'lib/jebanni/request_handler/processor.rb', line 14 def initialize(request_handler) @request_handler = request_handler end |
Instance Attribute Details
#params ⇒ Object
Returns the value of attribute params.
12 13 14 |
# File 'lib/jebanni/request_handler/processor.rb', line 12 def params @params end |
Instance Method Details
#channel ⇒ Object
30 31 32 33 |
# File 'lib/jebanni/request_handler/processor.rb', line 30 def channel return unless @channel_id server.channels[@channel_id] end |
#channel_id(id) ⇒ Object
23 24 25 26 27 28 |
# File 'lib/jebanni/request_handler/processor.rb', line 23 def channel_id(id) @channel_id = id unless server.channels[@channel_id] server.channels[@channel_id] = Channel.new(@channel_id, server) end end |
#finish! ⇒ Object
41 42 43 |
# File 'lib/jebanni/request_handler/processor.rb', line 41 def finish! @finish = true end |
#finished? ⇒ Boolean
45 46 47 |
# File 'lib/jebanni/request_handler/processor.rb', line 45 def finished? @finish end |
#on_first_connect(&block) ⇒ Object
35 36 37 38 39 |
# File 'lib/jebanni/request_handler/processor.rb', line 35 def on_first_connect(&block) if channel.connections.length == 0 instance_eval(&block) end end |
#response ⇒ Object
49 50 51 52 53 |
# File 'lib/jebanni/request_handler/processor.rb', line 49 def response channel_id params[:channel_id] if params[:channel_id] process self end |
#route=(found_route) ⇒ Object
18 19 20 21 |
# File 'lib/jebanni/request_handler/processor.rb', line 18 def route=(found_route) @route = found_route self.class.send(:define_method, :process, @route[:process]) end |