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
-
#cache_key ⇒ Object
readonly
private
Stable identity for the underlying config snapshot.
- #context ⇒ Object readonly private
- #format ⇒ Object readonly private
- #inflector ⇒ Object readonly private
- #part_builder ⇒ Object readonly private
- #part_class ⇒ Object readonly private
- #part_namespace ⇒ Object readonly private
- #renderer ⇒ Object readonly private
- #scope_builder ⇒ Object readonly private
- #scope_class ⇒ Object readonly private
- #scope_namespace ⇒ Object readonly private
Instance Method Summary collapse
-
#current_template_name ⇒ String?
Returns the resolved name of the template or partial currently being rendered, or nil if no render is in progress.
-
#current_template_names ⇒ Array<String>
private
Returns the stack of resolved names for the templates and partials currently being rendered.
-
#initialize(config_data:, 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
rubocop:disable Style/OptionalArguments.
- #template(name, scope, &block) ⇒ Object private
Constructor Details
#initialize(config_data:, 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.
19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 |
# File 'lib/hanami/view/rendering.rb', line 19 def initialize(config_data:, format:, context:) @format = format @inflector = config_data.inflector @part_builder = config_data.part_builder @scope_builder = config_data.scope_builder @part_class = config_data.part_class @part_namespace = config_data.part_namespace @scope_class = config_data.scope_class @scope_namespace = config_data.scope_namespace @cache_key = config_data.object_id @context = context.dup_for_rendering(self) @renderer = Renderer.new(config_data) end |
Instance Attribute Details
#cache_key ⇒ 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.
Stable identity for the underlying config snapshot.
15 16 17 |
# File 'lib/hanami/view/rendering.rb', line 15 def cache_key @cache_key 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.
17 18 19 |
# File 'lib/hanami/view/rendering.rb', line 17 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.
8 9 10 |
# File 'lib/hanami/view/rendering.rb', line 8 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.
10 11 12 |
# File 'lib/hanami/view/rendering.rb', line 10 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.
10 11 12 |
# File 'lib/hanami/view/rendering.rb', line 10 def part_builder @part_builder end |
#part_class ⇒ 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.
12 13 14 |
# File 'lib/hanami/view/rendering.rb', line 12 def part_class @part_class end |
#part_namespace ⇒ 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.
12 13 14 |
# File 'lib/hanami/view/rendering.rb', line 12 def part_namespace @part_namespace 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.
17 18 19 |
# File 'lib/hanami/view/rendering.rb', line 17 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.
10 11 12 |
# File 'lib/hanami/view/rendering.rb', line 10 def scope_builder @scope_builder end |
#scope_class ⇒ 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.
12 13 14 |
# File 'lib/hanami/view/rendering.rb', line 12 def scope_class @scope_class end |
#scope_namespace ⇒ 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.
12 13 14 |
# File 'lib/hanami/view/rendering.rb', line 12 def scope_namespace @scope_namespace end |
Instance Method Details
#current_template_name ⇒ String?
Returns the resolved name of the template or partial currently being rendered, or nil if no render is in progress.
43 44 45 |
# File 'lib/hanami/view/rendering.rb', line 43 def current_template_name renderer.current_template_name end |
#current_template_names ⇒ Array<String>
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 the stack of resolved names for the templates and partials currently being rendered.
54 55 56 |
# File 'lib/hanami/view/rendering.rb', line 54 def current_template_names renderer.current_template_names end |
#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.
66 67 68 |
# File 'lib/hanami/view/rendering.rb', line 66 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.
62 63 64 |
# File 'lib/hanami/view/rendering.rb', line 62 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.
rubocop:disable Style/OptionalArguments
70 71 72 |
# File 'lib/hanami/view/rendering.rb', line 70 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.
58 59 60 |
# File 'lib/hanami/view/rendering.rb', line 58 def template(name, scope, &block) renderer.template(name, format, scope, &block) end |