Class: Dry::View::PartBuilder Private
- Inherits:
-
Object
- Object
- Dry::View::PartBuilder
- Extended by:
- Core::Cache
- Defined in:
- lib/dry/view/part_builder.rb
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.
Decorates exposure values with matching parts
Instance Attribute Summary collapse
- #namespace ⇒ Object readonly private
- #render_env ⇒ Object readonly private
Instance Method Summary collapse
-
#call(name, value, **options) ⇒ Dry::View::Part
private
Decorates an exposure value.
- #for_render_env(render_env) ⇒ Object private
-
#initialize(namespace: nil, render_env: nil) ⇒ PartBuilder
constructor
private
Returns a new instance of PartBuilder.
Constructor Details
#initialize(namespace: nil, render_env: nil) ⇒ PartBuilder
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 PartBuilder
22 23 24 25 |
# File 'lib/dry/view/part_builder.rb', line 22 def initialize(namespace: nil, render_env: nil) @namespace = namespace @render_env = render_env end |
Instance Attribute Details
#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.
16 17 18 |
# File 'lib/dry/view/part_builder.rb', line 16 def namespace @namespace end |
#render_env ⇒ 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/dry/view/part_builder.rb', line 17 def render_env @render_env end |
Instance Method Details
#call(name, value, **options) ⇒ Dry::View::Part
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.
Decorates an exposure value
43 44 45 46 47 |
# File 'lib/dry/view/part_builder.rb', line 43 def call(name, value, **) builder = value.respond_to?(:to_ary) ? :build_collection_part : :build_part send(builder, name, value, **) end |
#for_render_env(render_env) ⇒ 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.
28 29 30 31 32 |
# File 'lib/dry/view/part_builder.rb', line 28 def for_render_env(render_env) return self if render_env == self.render_env self.class.new(namespace: namespace, render_env: render_env) end |