method
locals_code
v7.0.0 -
Show latest stable
-
0 notes -
Class: ActionView::Template
- 1.0.0
- 1.1.6
- 1.2.6
- 2.0.3
- 2.1.0
- 2.2.1
- 2.3.8
- 3.0.0
- 3.0.9
- 3.1.0 (0)
- 3.2.1 (0)
- 3.2.8 (0)
- 3.2.13 (0)
- 4.0.2 (0)
- 4.1.8 (0)
- 4.2.1 (0)
- 4.2.7 (0)
- 4.2.9 (0)
- 5.0.0.1 (0)
- 5.1.7 (0)
- 5.2.3 (0)
- 6.0.0 (0)
- 6.1.3.1 (0)
- 6.1.7.7 (0)
- 7.0.0 (0)
- 7.1.3.2 (0)
- 7.1.3.4 (0)
- What's this?
locals_code()
public
Hide source
# File actionview/lib/action_view/template.rb, line 325 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:]_]|[^\00--\1177])+\z/) else locals = locals.grep(/\A(?![A-Z0-9])(?:[[:alnum:]_]|[^\00--\1177])+\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