Class: Jets::Controller::Base

Inherits:
Lambda::Functions show all
Includes:
AbstractController::AssetPaths, AbstractController::Callbacks, AbstractController::Rendering, AbstractController::Translation, ActionController::Caching, ActionController::ConditionalGet, ActionController::ContentSecurityPolicy, ActionController::Cookies, ActionController::EtagWithFlash, ActionController::EtagWithTemplateDigest, ActionController::Flash, ActionController::FormBuilder, ActionController::Helpers, ActionController::HttpAuthentication::Basic::ControllerMethods, ActionController::HttpAuthentication::Digest::ControllerMethods, ActionController::HttpAuthentication::Token::ControllerMethods, ActionController::ImplicitRender, ActionController::Instrumentation, ActionController::Logging, ActionController::MimeResponds, ActionController::ParameterEncoding, ActionController::ParamsWrapper, ActionController::PermissionsPolicy, ActionController::Redirecting, ActionController::Renderers::All, ActionController::Rendering, ActionController::RequestForgeryProtection, ActionController::Rescue, ActionController::StrongParameters, ActionController::UrlFor, ActionView::Layouts, Compat::AbstractController::Base, Compat::ActionController::Metal, Compat::Caching, Compat::Future, Compat::RouteSet, Decorate::Authorization, Decorate::Logging, Decorate::Redirecting, Decorate::UrlFor, Handler, RackAdapter::Action, Router::Helpers::NamedRoutes
Defined in:
lib/jets/controller/base.rb

Direct Known Subclasses

ApplicationController

Instance Attribute Summary

Attributes inherited from Lambda::Functions

#context, #event, #meth

Instance Method Summary collapse

Methods included from Decorate::Logging

#dispatch!, #event_log, #filter_json_log, #json_dump_log, #log_event?, #log_finish, #log_start, #processing_log

Methods included from Decorate::Redirecting

#_compute_redirect_to_location, #redirect_back

Methods included from Decorate::ApigwStage

#add_apigw_stage, #add_apigw_stage?

Methods included from Decorate::UrlFor

#url_for

Methods included from Handler

#process!

Methods included from Compat::Future

#raise_on_missing_callback_actions

Methods included from Compat::ActionController::Metal

#dispatch!, #method_override!, #performed?, #response=, #response_body=

Methods included from Compat::AbstractController::Base

#action_name, #available_action?, #inspect, #performed?, #response_body

Methods inherited from Lambda::Functions

#_normalize_options, _prefixes, abstract!, inherited, #logger, output_keys, subclasses

Methods included from Lambda::Dsl

#lambda_functions

Constructor Details

#initialize(event, context, meth, rack_env) ⇒ Base

Returns a new instance of Base.



85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
# File 'lib/jets/controller/base.rb', line 85

def initialize(event, context, meth, rack_env)
  # Passing in rack env so the same rack env (same object id) is used.
  # This is important for:
  #  1. Constraints lambda procs
  #  2. Controller.action rack methods
  @event = event
  @context = context
  @meth = meth
  @rack_env = rack_env
  @_request = Jets::Controller::Request.new(event: event, rack_env: @rack_env)
  # Note: Rails sets request.route in the Rails::Engine#build_request instead.
  # The Jets request class is built slightly differently, so set it here.
  # The request.routes method is need to that url_helpers work in generally.
  # It's just how Rails ActionView implements url_helpers.
  @_request.routes = self.class._routes
  @_response = Jets::Controller::Response.new
  @_response.request = @request
  # Jets::Controller::Base#initialize interface is different than ActionController::Controller::Base.
  # The super call goes to ActionController modules that can decorate and call super again.
  # At the end of the module chain is Jets::Controller::Compat::ActionController::Metal#initialize
  # which goes back to the original Jets::Lambda::Functions#initialize(event, context, meth) interface.
  super() # ActionController::Base#initialize() interface
end