method

bind_locals

Importance_0
Ruby on Rails latest stable (v7.1.3.2) - 0 notes - Class: UnboundTemplate
bind_locals(locals) public

No documentation

This method has no description. You can help the Ruby on Rails community by adding new notes.

Hide source
# File actionview/lib/action_view/unbound_template.rb, line 20
    def bind_locals(locals)
      unless template = @templates[locals]
        @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.
          template = (@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] = template

          if template.strict_locals?
            # Under strict locals, we only need one template.
            # This replaces the @templates Concurrent::Map with a hash which
            # returns this template for every key.
            @templates = Hash.new(template).freeze
          end
        end
      end
      template
    end
Register or log in to add new notes.