instance method
locals_code
Ruby on Rails 5.1.7
Since v5.1.7 Last seen in v8.1.3.1 Private — implementation detail, not part of the public APISignature
locals_code()
No documentation comment.
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
locals = locals.grep(/\A@?(?![A-Z0-9])(?:[[:alnum:]_]|[^\0-\177])+\z/)
# Double assign to suppress the dreaded 'assigned but unused variable' warning
locals.each_with_object("") { |key, code| code << "#{key} = #{key} = local_assigns[:#{key}];" }
end
Defined in actionview/lib/action_view/template.rb line 325
· View on GitHub
· Improve this page
· Find usages on GitHub
Defined in ActionView::Template