class ActionView::UnboundTemplate

Public Class Methods

new(source, identifier, handler, options) click to toggle source
# File lib/action_view/unbound_template.rb, line 7
def initialize(source, identifier, handler, options)
  @source = source
  @identifier = identifier
  @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 16
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 21
def build_template(locals)
  options = @options.merge(locals: locals)
  Template.new(
    @source,
    @identifier,
    @handler,
    **options
  )
end