Class: RailsTwirp::Base
- Includes:
- AbstractController::AssetPaths, AbstractController::Callbacks, AbstractController::Rendering, ActionController::Helpers, ActionView::Rendering, Errors, ExceptionHandling, ImplicitRender, Instrumentation, RenderPb, Rescue, UrlFor
- Defined in:
- lib/rails_twirp/base.rb
Class Method Summary collapse
Instance Method Summary collapse
-
#details_for_lookup ⇒ Object
Used by the template renderer to figure out which template to use.
- #dispatch(action, request, response_class, rpc_name, env = {}) ⇒ Object
- #http_request ⇒ Object
-
#initialize ⇒ Base
constructor
A new instance of Base.
-
#request ⇒ Object
:attr_reader: request.
Methods included from ExceptionHandling
Methods included from Instrumentation
Methods included from ImplicitRender
Methods included from Errors
Methods included from RenderPb
#_render_to_body_with_pb, #render_to_body
Methods included from UrlFor
Methods inherited from Metal
controller_name, #controller_name
Constructor Details
#initialize ⇒ Base
Returns a new instance of Base.
49 50 51 52 53 54 |
# File 'lib/rails_twirp/base.rb', line 49 def initialize @_request = nil @_env = nil @_response_class = nil super end |
Class Method Details
.dispatch(action, request, response_class, rpc_name, env = {}) ⇒ Object
73 74 75 |
# File 'lib/rails_twirp/base.rb', line 73 def self.dispatch(action, request, response_class, rpc_name, env = {}) new.dispatch(action, request, response_class, rpc_name, env) end |
Instance Method Details
#details_for_lookup ⇒ Object
Used by the template renderer to figure out which template to use
78 79 80 |
# File 'lib/rails_twirp/base.rb', line 78 def details_for_lookup {formats: [:pb], handlers: [:pbbuilder]} end |
#dispatch(action, request, response_class, rpc_name, env = {}) ⇒ Object
60 61 62 63 64 65 66 67 68 69 70 71 |
# File 'lib/rails_twirp/base.rb', line 60 def dispatch(action, request, response_class, rpc_name, env = {}) self.request = request self.env = env self.response_class = response_class self.rpc_name = rpc_name http_request.controller_instance = self process(action) response_body end |
#http_request ⇒ Object
56 57 58 |
# File 'lib/rails_twirp/base.rb', line 56 def http_request @_http_request ||= ActionDispatch::Request.new(env[:rack_env]) end |
#request ⇒ Object
:attr_reader: request
The ActionDispatch::Request instance for the current request.
45 |
# File 'lib/rails_twirp/base.rb', line 45 attr_internal :request |