Class: Hanami::View::Rendering Private
Overview
This class is part of a private API. You should avoid using this class if possible, as it may be removed or be changed in the future.
Instance Attribute Summary collapse
- #config ⇒ Object readonly private
- #context ⇒ Object readonly private
- #format ⇒ Object readonly private
- #inflector ⇒ Object readonly private
- #part_builder ⇒ Object readonly private
- #renderer ⇒ Object readonly private
- #scope_builder ⇒ Object readonly private
Instance Method Summary collapse
-
#initialize(config:, format:, context:) ⇒ Rendering
constructor
private
A new instance of Rendering.
- #part(name, value, as: nil) ⇒ Object private
- #partial(name, scope, &block) ⇒ Object private
- #scope(name = nil, locals) ⇒ Object private
- #template(name, scope, &block) ⇒ Object private
Constructor Details
#initialize(config:, format:, context:) ⇒ Rendering
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 Rendering.
22 23 24 25 26 27 28 29 30 31 32 |
# File 'lib/hanami/view/rendering.rb', line 22 def initialize(config:, format:, context:) @config = config @format = format @inflector = config.inflector @part_builder = config.part_builder @scope_builder = config.scope_builder @context = context.dup_for_rendering(self) @renderer = Renderer.new(config) end |
Instance Attribute Details
#config ⇒ Object (readonly)
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.
10 11 12 |
# File 'lib/hanami/view/rendering.rb', line 10 def config @config end |
#context ⇒ Object (readonly)
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.
18 19 20 |
# File 'lib/hanami/view/rendering.rb', line 18 def context @context end |
#format ⇒ Object (readonly)
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.
10 11 12 |
# File 'lib/hanami/view/rendering.rb', line 10 def format @format end |
#inflector ⇒ Object (readonly)
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.
14 15 16 |
# File 'lib/hanami/view/rendering.rb', line 14 def inflector @inflector end |
#part_builder ⇒ Object (readonly)
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.
14 15 16 |
# File 'lib/hanami/view/rendering.rb', line 14 def part_builder @part_builder end |
#renderer ⇒ Object (readonly)
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.
18 19 20 |
# File 'lib/hanami/view/rendering.rb', line 18 def renderer @renderer end |
#scope_builder ⇒ Object (readonly)
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.
14 15 16 |
# File 'lib/hanami/view/rendering.rb', line 14 def scope_builder @scope_builder end |
Instance Method Details
#part(name, value, as: nil) ⇒ Object
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.
48 49 50 |
# File 'lib/hanami/view/rendering.rb', line 48 def part(name, value, as: nil) part_builder.(name, value, as: as, rendering: self) end |
#partial(name, scope, &block) ⇒ Object
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.
42 43 44 |
# File 'lib/hanami/view/rendering.rb', line 42 def partial(name, scope, &block) renderer.partial(name, format, scope, &block) end |
#scope(name = nil, locals) ⇒ Object
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.
54 55 56 |
# File 'lib/hanami/view/rendering.rb', line 54 def scope(name = nil, locals) # rubocop:disable Style/OptionalArguments scope_builder.(name, locals: locals, rendering: self) end |
#template(name, scope, &block) ⇒ Object
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.
36 37 38 |
# File 'lib/hanami/view/rendering.rb', line 36 def template(name, scope, &block) renderer.template(name, format, scope, &block) end |