class ActionView::UnboundTemplate

Public Class Methods

new(source, identifer, handler, options) click to toggle source
# File lib/action_view/unbound_template.rb, line 6
def initialize(source, identifer, handler, options)
  @source = source
  @identifer = identifer
  @handler = handler
  @options = options

  @templates = Concurrent::Map.new(initial_capacity: 2)
end

Public Instance Methods

bind_locals(locals) click to toggle source
# File lib/action_view/unbound_template.rb, line 15
def bind_locals(locals)
  @templates[locals] ||= build_template(locals)
end

Private Instance Methods

build_template(locals) click to toggle source
# File lib/action_view/unbound_template.rb, line 20
def build_template(locals)
  options = @options.merge(locals: locals)
  Template.new(
    @source,
    @identifer,
    @handler,
    **options
  )
end