Sha256: 9b1f7e76dcad9ba4c2e637a57bbb441e70094080b4bbfd5dae7efeaa03ef4813

Contents?: true

Size: 643 Bytes

Versions: 22

Compression:

Stored size: 643 Bytes

Contents

# frozen_string_literal: true

require "concurrent/map"

module ActionView
  class UnboundTemplate
    def initialize(source, identifer, handler, options)
      @source = source
      @identifer = identifer
      @handler = handler
      @options = options

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

    def bind_locals(locals)
      @templates[locals] ||= build_template(locals)
    end

    private
      def build_template(locals)
        options = @options.merge(locals: locals)
        Template.new(
          @source,
          @identifer,
          @handler,
          **options
        )
      end
  end
end

Version data entries

22 entries across 22 versions & 1 rubygems

Version Path
actionview-6.0.6.1 lib/action_view/unbound_template.rb
actionview-6.0.6 lib/action_view/unbound_template.rb
actionview-6.0.5.1 lib/action_view/unbound_template.rb
actionview-6.0.5 lib/action_view/unbound_template.rb
actionview-6.0.4.8 lib/action_view/unbound_template.rb
actionview-6.0.4.7 lib/action_view/unbound_template.rb
actionview-6.0.4.6 lib/action_view/unbound_template.rb
actionview-6.0.4.5 lib/action_view/unbound_template.rb
actionview-6.0.4.4 lib/action_view/unbound_template.rb
actionview-6.0.4.3 lib/action_view/unbound_template.rb
actionview-6.0.4.2 lib/action_view/unbound_template.rb
actionview-6.0.4.1 lib/action_view/unbound_template.rb
actionview-6.0.4 lib/action_view/unbound_template.rb
actionview-6.0.3.7 lib/action_view/unbound_template.rb
actionview-6.0.3.6 lib/action_view/unbound_template.rb
actionview-6.0.3.5 lib/action_view/unbound_template.rb
actionview-6.0.3.4 lib/action_view/unbound_template.rb
actionview-6.0.3.3 lib/action_view/unbound_template.rb
actionview-6.0.3.2 lib/action_view/unbound_template.rb
actionview-6.0.3.1 lib/action_view/unbound_template.rb