Class: Dry::View::ScopeBuilder Private
- Inherits:
-
Object
- Object
- Dry::View::ScopeBuilder
- Extended by:
- Core::Cache
- Defined in:
- lib/dry/view/scope_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.
Builds scope objects via matching classes
Instance Attribute Summary collapse
-
#namespace ⇒ Object
readonly
private
The view’s configured ‘scope_namespace`.
- #render_env ⇒ RenderEnvironment readonly private
Instance Method Summary collapse
-
#call(name = nil, locals) ⇒ Dry::View::Scope
private
Returns a new scope using a class matching the name.
- #for_render_env(render_env) ⇒ Object private
-
#initialize(namespace: nil, render_env: nil) ⇒ ScopeBuilder
constructor
private
Returns a new instance of ScopeBuilder.
Constructor Details
#initialize(namespace: nil, render_env: nil) ⇒ ScopeBuilder
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 ScopeBuilder
29 30 31 32 |
# File 'lib/dry/view/scope_builder.rb', line 29 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.
The view’s configured ‘scope_namespace`
19 20 21 |
# File 'lib/dry/view/scope_builder.rb', line 19 def namespace @namespace end |
#render_env ⇒ RenderEnvironment (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.
24 25 26 |
# File 'lib/dry/view/scope_builder.rb', line 24 def render_env @render_env end |
Instance Method Details
#call(name = nil, locals) ⇒ Dry::View::Scope
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 scope using a class matching the name
49 50 51 52 53 54 55 |
# File 'lib/dry/view/scope_builder.rb', line 49 def call(name = nil, locals) # rubocop:disable Style/OptionalArguments scope_class(name).new( name: name, locals: locals, render_env: render_env ) 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.
35 36 37 38 39 |
# File 'lib/dry/view/scope_builder.rb', line 35 def for_render_env(render_env) return self if render_env == self.render_env self.class.new(namespace: namespace, render_env: render_env) end |