class ActionView::UnboundTemplate

Experimental RBS support (using type sampling data from the type_fusion project).

# sig/action_view/unbound_template.rbs

class ActionView::UnboundTemplate
  def bind_locals: (Array[] locals) -> ActionView::Template
  def build_template: (Array[] locals) -> ActionView::Template
  def initialize: (ActionView::Template::Sources::File source, String identifier, details: ActionView::TemplateDetails, virtual_path: String) -> void
  def normalize_locals: (Array[] locals) -> Array[]
end

def bind_locals(locals)

Experimental RBS support (using type sampling data from the type_fusion project).

def bind_locals: ( locals) -> ActionView::Template

This signature was generated using 8 samples from 1 application.

def bind_locals(locals)
  if template = @templates[locals]
    template
  else
    @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.
      @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] = @templates[normalized_locals]
    end
  end
end

def build_template(locals)

Experimental RBS support (using type sampling data from the type_fusion project).

def build_template: ( locals) -> ActionView::Template

This signature was generated using 1 sample from 1 application.

def build_template(locals)
  Template.new(
    @source,
    @identifier,
    details.handler_class,
    format: details.format_or_default,
    variant: variant&.to_s,
    virtual_path: @virtual_path,
    locals: locals.map(&:to_s)
  )
end

def initialize(source, identifier, details:, virtual_path:)

Experimental RBS support (using type sampling data from the type_fusion project).

def initialize: (ActionView::Template::Sources::File source, String identifier, details: ActionView::TemplateDetails, virtual_path: String) -> void

This signature was generated using 5 samples from 1 application.

def initialize(source, identifier, details:, virtual_path:)
  @source = source
  @identifier = identifier
  @details = details
  @virtual_path = virtual_path
  @templates = Concurrent::Map.new(initial_capacity: 2)
  @write_lock = Mutex.new
end

def normalize_locals(locals)

Experimental RBS support (using type sampling data from the type_fusion project).

def normalize_locals: ( locals) ->

This signature was generated using 3 samples from 1 application.

def normalize_locals(locals)
  locals.map(&:to_sym).sort!.freeze
end