Module: Cuprum::Rails::Responders::Html::Rendering
- Included in:
- Cuprum::Rails::Responders::HtmlResponder
- Defined in:
- lib/cuprum/rails/responders/html/rendering.rb
Overview
Implements generating HTML response objects.
Instance Method Summary collapse
-
#head(status:) ⇒ Cuprum::Rails::Responses::HeadResponse
Creates a HeadResponse based on the given HTTP status.
-
#redirect_back(fallback_location: '/', flash: {}, status: 302) ⇒ Object
Creates a RedirectBackResponse based on the given HTTP status.
-
#redirect_to(path, flash: {}, status: 302) ⇒ Cuprum::Rails::Responses::Html::RedirectResponse
Creates a RedirectResponse based on the given path and HTTP status.
-
#render(template, assigns: nil, flash: {}, layout: nil, status: 200) ⇒ Cuprum::Rails::Responses::Html::RenderResponse
Creates a RenderResponse based on the given template and parameters.
Instance Method Details
#head(status:) ⇒ Cuprum::Rails::Responses::HeadResponse
Creates a HeadResponse based on the given HTTP status.
13 14 15 |
# File 'lib/cuprum/rails/responders/html/rendering.rb', line 13 def head(status:) Cuprum::Rails::Responses::HeadResponse.new(status: status) end |
#redirect_back(fallback_location: '/', flash: {}, status: 302) ⇒ Object
Creates a RedirectBackResponse based on the given HTTP status.
23 24 25 26 |
# File 'lib/cuprum/rails/responders/html/rendering.rb', line 23 def redirect_back(fallback_location: '/', flash: {}, status: 302) Cuprum::Rails::Responses::Html::RedirectBackResponse .new(fallback_location: fallback_location, flash: flash, status: status) end |
#redirect_to(path, flash: {}, status: 302) ⇒ Cuprum::Rails::Responses::Html::RedirectResponse
Creates a RedirectResponse based on the given path and HTTP status.
35 36 37 38 |
# File 'lib/cuprum/rails/responders/html/rendering.rb', line 35 def redirect_to(path, flash: {}, status: 302) Cuprum::Rails::Responses::Html::RedirectResponse .new(path, flash: flash, status: status) end |
#render(template, assigns: nil, flash: {}, layout: nil, status: 200) ⇒ Cuprum::Rails::Responses::Html::RenderResponse
Creates a RenderResponse based on the given template and parameters.
49 50 51 52 53 54 55 56 57 |
# File 'lib/cuprum/rails/responders/html/rendering.rb', line 49 def render(template, assigns: nil, flash: {}, layout: nil, status: 200) Cuprum::Rails::Responses::Html::RenderResponse.new( template, assigns: assigns || default_assigns, flash: flash, layout: layout, status: status ) end |