Class: Dry::View::Rendered
- Inherits:
-
Object
- Object
- Dry::View::Rendered
- Defined in:
- lib/dry/view/rendered.rb
Overview
Output of a View rendering
Instance Attribute Summary collapse
-
#locals ⇒ Hash[<Symbol, Dry::View::Part>] locals hash
readonly
Returns the hash of locals used to render the view.
-
#output ⇒ String
readonly
Returns the rendered view.
Instance Method Summary collapse
-
#[](name) ⇒ Dry::View::Part
Returns the local corresponding to the key.
-
#initialize(output:, locals:) ⇒ Rendered
constructor
private
A new instance of Rendered.
-
#to_s ⇒ String
(also: #to_str)
Returns the rendered view.
Constructor Details
#initialize(output:, locals:) ⇒ Rendered
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
Returns a new instance of Rendered.
28 29 30 31 |
# File 'lib/dry/view/rendered.rb', line 28 def initialize(output:, locals:) @output = output @locals = locals end |
Instance Attribute Details
#locals ⇒ Hash[<Symbol, Dry::View::Part>] locals hash (readonly)
Returns the hash of locals used to render the view
25 26 27 |
# File 'lib/dry/view/rendered.rb', line 25 def locals @locals end |
#output ⇒ String (readonly)
Returns the rendered view
18 19 20 |
# File 'lib/dry/view/rendered.rb', line 18 def output @output end |
Instance Method Details
#[](name) ⇒ Dry::View::Part
Returns the local corresponding to the key
40 41 42 |
# File 'lib/dry/view/rendered.rb', line 40 def [](name) locals[name] end |
#to_s ⇒ String Also known as: to_str
Returns the rendered view
49 50 51 |
# File 'lib/dry/view/rendered.rb', line 49 def to_s output end |