diff options
Diffstat (limited to 'actionpack/lib/action_controller/new_base/http.rb')
-rw-r--r-- | actionpack/lib/action_controller/new_base/http.rb | 56 |
1 files changed, 56 insertions, 0 deletions
diff --git a/actionpack/lib/action_controller/new_base/http.rb b/actionpack/lib/action_controller/new_base/http.rb new file mode 100644 index 0000000000..f663900944 --- /dev/null +++ b/actionpack/lib/action_controller/new_base/http.rb @@ -0,0 +1,56 @@ +module ActionController + class Http < AbstractController::Base + abstract! + + # :api: public + attr_internal :request, :response, :params + + # :api: public + def self.controller_name + @controller_name ||= controller_path.split("/").last + end + + # :api: public + def controller_name() self.class.controller_name end + + # :api: public + def self.controller_path + @controller_path ||= self.name.sub(/Controller$/, '').underscore + end + + # :api: public + def controller_path() self.class.controller_path end + + # :api: private + def self.internal_methods + ActionController::Http.public_instance_methods(true) + end + + # :api: private + def self.action_names() action_methods end + + # :api: private + def action_names() action_methods end + + # :api: plugin + def self.call(env) + controller = new + controller.call(env).to_rack + end + + # :api: private + def call(env) + @_request = ActionDispatch::Request.new(env) + @_response = ActionDispatch::Response.new + process(@_request.parameters[:action]) + @_response.body = response_body + @_response.prepare! + self + end + + # :api: private + def to_rack + @_response.to_a + end + end +end |