Class: Gritz::Compat::Gruf::Controller
- Inherits:
-
Gritz::Controller
- Object
- Gritz::Controller
- Gritz::Compat::Gruf::Controller
- Includes:
- ErrorHelpers
- Defined in:
- /home/runner/work/gritz/gritz/sources/gritz-core/lib/gritz/compat/gruf.rb
Overview
Controller base retaining selected Gruf request, error and streaming APIs.
Instance Attribute Summary
Attributes inherited from Gritz::Controller
Class Method Summary collapse
Instance Method Summary collapse
- #error ⇒ Object
-
#initialize(context:) ⇒ Controller
constructor
A new instance of Controller.
- #process(action) ⇒ Object
Methods included from ErrorHelpers
#add_field_error, #fail!, #has_field_errors?, #set_debug_info
Methods inherited from Gritz::Controller
after_action, around_action, before_action, bind, #fail!, filters, rescue_from, rescue_handlers, service_class
Constructor Details
#initialize(context:) ⇒ Controller
Returns a new instance of Controller.
155 156 157 158 |
# File '/home/runner/work/gritz/gritz/sources/gritz-core/lib/gritz/compat/gruf.rb', line 155 def initialize(context:) super @request = Gruf.request_for(context) end |
Class Method Details
.action_defined?(action) ⇒ Boolean
151 152 153 |
# File '/home/runner/work/gritz/gritz/sources/gritz-core/lib/gritz/compat/gruf.rb', line 151 def self.action_defined?(action) super && ![Controller, ErrorHelpers].include?(instance_method(action).owner) end |
.bound_service ⇒ Object
149 |
# File '/home/runner/work/gritz/gritz/sources/gritz-core/lib/gritz/compat/gruf.rb', line 149 def self.bound_service = service_class |
Instance Method Details
#error ⇒ Object
160 |
# File '/home/runner/work/gritz/gritz/sources/gritz-core/lib/gritz/compat/gruf.rb', line 160 def error = request.error |
#process(action) ⇒ Object
162 163 164 165 166 167 168 |
# File '/home/runner/work/gritz/gritz/sources/gritz-core/lib/gritz/compat/gruf.rb', line 162 def process(action) result = super return result unless context.method.server_streaming? result.each { || stream.write() } if result.respond_to?(:each) nil end |