class ActionView::Template

def locals_code

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

def locals_code: () -> String

This signature was generated using 2 samples from 2 applications.

def locals_code
  # Only locals with valid variable names get set directly. Others will
  # still be available in local_assigns.
  locals = @locals - Module::RUBY_RESERVED_KEYWORDS
  deprecated_locals = locals.grep(/\A@+/)
  if deprecated_locals.any?
    ActiveSupport::Deprecation.warn(<<~MSG)
      Passing instance variables to `render` is deprecated.
      In Rails 7.1, #{deprecated_locals.to_sentence} will be ignored.
    MSG
    locals = locals.grep(/\A@?(?![A-Z0-9])(?:[[:alnum:]_]|[^\0-\177])+\z/)
  else
    locals = locals.grep(/\A(?![A-Z0-9])(?:[[:alnum:]_]|[^\0-\177])+\z/)
  end
  # Assign for the same variable is to suppress unused variable warning
  locals.each_with_object(+"") { |key, code| code << "#{key} = local_assigns[:#{key}]; #{key} = #{key};" }
end