Class: MuchRails::Action::RenderResult

Inherits:
BaseResult
  • Object
show all
Defined in:
lib/much-rails/action/render_result.rb

Overview

MuchRails::Action::RenderResult is a result returned by calling a view action that directs the controller to render a response.

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(render_view_model, **render_kargs) ⇒ RenderResult

Returns a new instance of RenderResult.



13
14
15
16
# File 'lib/much-rails/action/render_result.rb', line 13

def initialize(render_view_model, **render_kargs)
  @render_view_model = render_view_model
  @render_kargs = render_kargs
end

Instance Attribute Details

#render_kargsObject (readonly)

Returns the value of attribute render_kargs.



11
12
13
# File 'lib/much-rails/action/render_result.rb', line 11

def render_kargs
  @render_kargs
end

#render_view_modelObject (readonly)

Returns the value of attribute render_view_model.



11
12
13
# File 'lib/much-rails/action/render_result.rb', line 11

def render_view_model
  @render_view_model
end

Instance Method Details

#execute_blockObject

This block is called using ‘instance_exec` in the scope of the controller



19
20
21
22
23
24
# File 'lib/much-rails/action/render_result.rb', line 19

def execute_block
  ->(result){
    @view = result.render_view_model
    render(**result.render_kargs)
  }
end