Skip to Content Skip to Search
Methods
B
N

Attributes

[R] details
[R] virtual_path

Class Public methods

new(source, identifier, details:, virtual_path:)

# File actionview/lib/action_view/unbound_template.rb, line 10
def initialize(source, identifier, details:, virtual_path:)
  @source = source
  @identifier = identifier
  @details = details
  @virtual_path = virtual_path

  @strict_locals_template = nil
  @templates = Concurrent::Map.new(initial_capacity: 2)
  @write_lock = Mutex.new
end

Instance Public methods

bind_locals(locals)

# File actionview/lib/action_view/unbound_template.rb, line 21
def bind_locals(locals)
  if @strict_locals_template
    @strict_locals_template
  elsif frozen?
    templates = ractor_local_templates
    unless template = templates[locals]
      normalized_locals = normalize_locals(locals)
      template = templates.compute_if_absent(normalized_locals) { build_template(normalized_locals) }
      templates[locals.dup] = template
    end
    template
  else
    @templates[locals] || build_bound_template(locals)
  end
end