Sha256: f6df1da6cf1fe7fb46d0e555d1e458103e76b6ea08586d9b1cf28c49b94eecc2

Contents?: true

Size: 642 Bytes

Versions: 22

Compression:

Stored size: 642 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 20 versions & 5 rubygems

Version Path
actionview-6.0.2.2 lib/action_view/unbound_template.rb
argon-1.3.1 vendor/bundle/ruby/2.7.0/gems/actionview-6.0.2.1/lib/action_view/unbound_template.rb
symbolic_enum-1.1.5 vendor/bundle/ruby/2.7.0/gems/actionview-6.0.2.1/lib/action_view/unbound_template.rb
actionview-6.0.2.1 lib/action_view/unbound_template.rb
actionview-6.0.2 lib/action_view/unbound_template.rb
actionview-6.0.2.rc2 lib/action_view/unbound_template.rb
zuora_connect_ui-0.10.0 vendor/ruby/2.6.0/gems/actionview-6.0.1/lib/action_view/unbound_template.rb
zuora_connect_ui-0.10.0 vendor/ruby/2.6.0/gems/actionview-6.0.0/lib/action_view/unbound_template.rb
actionview-6.0.2.rc1 lib/action_view/unbound_template.rb
zuora_connect_ui-0.9.2 vendor/ruby/2.6.0/gems/actionview-6.0.0/lib/action_view/unbound_template.rb
zuora_connect_ui-0.9.2 vendor/ruby/2.6.0/gems/actionview-6.0.1/lib/action_view/unbound_template.rb
actionview-6.0.1 lib/action_view/unbound_template.rb
chatops-rpc-0.0.2 fixtures/chatops-controller-example/vendor/bundle/ruby/2.5.0/gems/actionview-6.0.0/lib/action_view/unbound_template.rb
actionview-6.0.1.rc1 lib/action_view/unbound_template.rb
chatops-rpc-0.0.1 fixtures/chatops-controller-example/vendor/bundle/ruby/2.5.0/gems/actionview-6.0.0/lib/action_view/unbound_template.rb
zuora_connect_ui-0.9.1 vendor/ruby/2.6.0/gems/actionview-6.0.0/lib/action_view/unbound_template.rb
zuora_connect_ui-0.9.0 vendor/ruby/2.6.0/gems/actionview-6.0.0/lib/action_view/unbound_template.rb
zuora_connect_ui-0.8.3 vendor/ruby/2.6.0/gems/actionview-6.0.0/lib/action_view/unbound_template.rb
zuora_connect_ui-0.8.2 vendor/ruby/2.6.0/gems/actionview-6.0.0/lib/action_view/unbound_template.rb
actionview-6.0.0 lib/action_view/unbound_template.rb