Class: Spine::Actions::Action
- Inherits:
-
Object
- Object
- Spine::Actions::Action
- Extended by:
- Filters
- Includes:
- Formats, Parameters, Responder
- Defined in:
- lib/spine/actions/action.rb
Instance Attribute Summary collapse
-
#env ⇒ Object
readonly
Returns the value of attribute env.
-
#request ⇒ Object
readonly
Returns the value of attribute request.
-
#response ⇒ Object
readonly
Returns the value of attribute response.
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(env) ⇒ Action
constructor
A new instance of Action.
Methods included from Filters
after, after_filters, after_filters_with_parents, before, before_filters, before_filters_with_parents, process_filters
Methods included from Parameters
Methods included from Formats
Methods included from Responder
#build_url, #finish_response, #redirect, #respond, #responded?, #send_data
Constructor Details
#initialize(env) ⇒ Action
Returns a new instance of Action.
11 12 13 14 15 |
# File 'lib/spine/actions/action.rb', line 11 def initialize(env) @env = env @request = Rack::Request.new(env) @response = Rack::Response.new end |
Instance Attribute Details
#env ⇒ Object (readonly)
Returns the value of attribute env.
9 10 11 |
# File 'lib/spine/actions/action.rb', line 9 def env @env end |
#request ⇒ Object (readonly)
Returns the value of attribute request.
9 10 11 |
# File 'lib/spine/actions/action.rb', line 9 def request @request end |
#response ⇒ Object (readonly)
Returns the value of attribute response.
9 10 11 |
# File 'lib/spine/actions/action.rb', line 9 def response @response end |
Class Method Details
.call(env) ⇒ Object
17 18 19 20 21 22 23 24 25 26 27 28 |
# File 'lib/spine/actions/action.rb', line 17 def self.call(env) handler = new(env) process_filters(handler, before_filters_with_parents) return handler.response.finish if handler.responded? handler.action process_filters(handler, after_filters_with_parents) raise StandardError.new('No response defined') unless handler.responded? handler.response.finish end |