Class: RubyWolf::Handler
- Inherits:
-
Object
- Object
- RubyWolf::Handler
- Defined in:
- lib/ruby_wolf/handler.rb
Instance Attribute Summary collapse
-
#app ⇒ Object
readonly
Returns the value of attribute app.
-
#callback ⇒ Object
readonly
Returns the value of attribute callback.
-
#connection ⇒ Object
readonly
Returns the value of attribute connection.
-
#env ⇒ Object
readonly
Returns the value of attribute env.
-
#response ⇒ Object
readonly
Returns the value of attribute response.
Instance Method Summary collapse
-
#initialize(app, connection, &callback) ⇒ Handler
constructor
A new instance of Handler.
- #process ⇒ Object
Constructor Details
#initialize(app, connection, &callback) ⇒ Handler
Returns a new instance of Handler.
8 9 10 11 12 13 14 |
# File 'lib/ruby_wolf/handler.rb', line 8 def initialize(app, connection, &callback) @app = app @connection = connection @callback = callback @env = {} @response = '' end |
Instance Attribute Details
#app ⇒ Object (readonly)
Returns the value of attribute app.
6 7 8 |
# File 'lib/ruby_wolf/handler.rb', line 6 def app @app end |
#callback ⇒ Object (readonly)
Returns the value of attribute callback.
6 7 8 |
# File 'lib/ruby_wolf/handler.rb', line 6 def callback @callback end |
#connection ⇒ Object (readonly)
Returns the value of attribute connection.
6 7 8 |
# File 'lib/ruby_wolf/handler.rb', line 6 def connection @connection end |
#env ⇒ Object (readonly)
Returns the value of attribute env.
6 7 8 |
# File 'lib/ruby_wolf/handler.rb', line 6 def env @env end |
#response ⇒ Object (readonly)
Returns the value of attribute response.
6 7 8 |
# File 'lib/ruby_wolf/handler.rb', line 6 def response @response end |
Instance Method Details
#process ⇒ Object
16 17 18 19 20 21 22 |
# File 'lib/ruby_wolf/handler.rb', line 16 def process prepare_rack_env parse_request generate_response callback.call(response) if callback response end |