Methods
Attributes
[R] | details | |
[R] | virtual_path |
Class Public methods
new(source, identifier, details:, virtual_path:)
📝 Source code
# 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
@templates = Concurrent::Map.new(initial_capacity: 2)
@write_lock = Mutex.new
end
🔎 See on GitHub
Instance Public methods
bind_locals(locals)
📝 Source code
# File actionview/lib/action_view/unbound_template.rb, line 20
def bind_locals(locals)
if template = @templates[locals]
template
else
@write_lock.synchronize do
normalized_locals = normalize_locals(locals)
# We need ||=, both to dedup on the normalized locals and to check
# while holding the lock.
@templates[normalized_locals] ||= build_template(normalized_locals)
# This may have already been assigned, but we've already de-dup'd so
# reassignment is fine.
@templates[locals.dup] = @templates[normalized_locals]
end
end
end
🔎 See on GitHub