diff --git a/actionpack/lib/abstract_controller/helpers.rb b/actionpack/lib/abstract_controller/helpers.rb index d0911bf661..c977ce2039 100644 --- a/actionpack/lib/abstract_controller/helpers.rb +++ b/actionpack/lib/abstract_controller/helpers.rb @@ -66,10 +66,10 @@ module AbstractController methods.each do |method| _helpers.class_eval <<-ruby_eval, file, line - def #{method}(*args, &blk) # def current_user(*args, &blk) - controller.send(%(#{method}), *args, &blk) # controller.send(:current_user, *args, &blk) - end # end - ruby2_keywords(%(#{method})) if respond_to?(:ruby2_keywords, true) + def #{method}(*args, &block) # def current_user(*args, &block) + controller.send(:'#{method}', *args, &block) # controller.send(:'current_user', *args, &block) + end # end + ruby2_keywords(:'#{method}') if respond_to?(:ruby2_keywords, true) ruby_eval end end diff --git a/actionpack/lib/action_dispatch/http/request.rb b/actionpack/lib/action_dispatch/http/request.rb index 0d3d332acd..4f7b59c79a 100644 --- a/actionpack/lib/action_dispatch/http/request.rb +++ b/actionpack/lib/action_dispatch/http/request.rb @@ -49,8 +49,9 @@ module ActionDispatch # See https://github.com/rack/rack/commit/c173b188d81ee437b588c1e046a1c9f031dea550 ENV_METHODS.each do |env| class_eval <<-METHOD, __FILE__, __LINE__ + 1 + # frozen_string_literal: true def #{env.sub(/^HTTP_/n, '').downcase} # def accept_charset - get_header "#{env}".freeze # get_header "HTTP_ACCEPT_CHARSET".freeze + get_header "#{env}" # get_header "HTTP_ACCEPT_CHARSET" end # end METHOD end diff --git a/actionpack/lib/action_dispatch/journey/route.rb b/actionpack/lib/action_dispatch/journey/route.rb index 0edda7d2d8..21ee766e5c 100644 --- a/actionpack/lib/action_dispatch/journey/route.rb +++ b/actionpack/lib/action_dispatch/journey/route.rb @@ -13,6 +13,7 @@ module ActionDispatch VERBS = %w{ DELETE GET HEAD OPTIONS LINK PATCH POST PUT TRACE UNLINK } VERBS.each do |v| class_eval <<-eoc, __FILE__, __LINE__ + 1 + # frozen_string_literal: true class #{v} def self.verb; name.split("::").last; end def self.call(req); req.#{v.downcase}?; end diff --git a/actionpack/lib/action_dispatch/routing/polymorphic_routes.rb b/actionpack/lib/action_dispatch/routing/polymorphic_routes.rb index d2d1849ae4..ebf054b81e 100644 --- a/actionpack/lib/action_dispatch/routing/polymorphic_routes.rb +++ b/actionpack/lib/action_dispatch/routing/polymorphic_routes.rb @@ -145,6 +145,7 @@ module ActionDispatch %w(edit new).each do |action| module_eval <<-EOT, __FILE__, __LINE__ + 1 + # frozen_string_literal: true def #{action}_polymorphic_url(record_or_hash, options = {}) polymorphic_url_for_action("#{action}", record_or_hash, options) end diff --git a/actionview/lib/action_view/helpers/form_helper.rb b/actionview/lib/action_view/helpers/form_helper.rb index de7271da56..582e7e17bf 100644 --- a/actionview/lib/action_view/helpers/form_helper.rb +++ b/actionview/lib/action_view/helpers/form_helper.rb @@ -1905,7 +1905,7 @@ module ActionView class_eval <<-RUBY_EVAL, __FILE__, __LINE__ + 1 def #{selector}(method, options = {}) # def text_field(method, options = {}) @template.send( # @template.send( - #{selector.inspect}, # "text_field", + #{selector.inspect}, # :text_field, @object_name, # @object_name, method, # method, objectify_options(options)) # objectify_options(options)) diff --git a/actionview/lib/action_view/layouts.rb b/actionview/lib/action_view/layouts.rb index b21dc1b9b3..24c2881cc0 100644 --- a/actionview/lib/action_view/layouts.rb +++ b/actionview/lib/action_view/layouts.rb @@ -321,6 +321,7 @@ module ActionView end class_eval <<-RUBY, __FILE__, __LINE__ + 1 + # frozen_string_literal: true def _layout(lookup_context, formats) if _conditional_layout? #{layout_definition} diff --git a/activemodel/lib/active_model/attribute_methods.rb b/activemodel/lib/active_model/attribute_methods.rb index f9d2cb5587..1f36eaebdf 100644 --- a/activemodel/lib/active_model/attribute_methods.rb +++ b/activemodel/lib/active_model/attribute_methods.rb @@ -495,7 +495,7 @@ module ActiveModel def self.define_attribute_accessor_method(mod, attr_name, writer: false) method_name = "#{attr_name}#{'=' if writer}" if attr_name.ascii_only? && DEF_SAFE_NAME.match?(attr_name) - yield method_name, "'#{attr_name}'.freeze" + yield method_name, "'#{attr_name}'" else safe_name = attr_name.unpack1("h*") const_name = "ATTR_#{safe_name}" diff --git a/activemodel/lib/active_model/attributes.rb b/activemodel/lib/active_model/attributes.rb index 023ba55580..8655ab8ca0 100644 --- a/activemodel/lib/active_model/attributes.rb +++ b/activemodel/lib/active_model/attributes.rb @@ -47,6 +47,7 @@ module ActiveModel generated_attribute_methods, name, writer: true, ) do |temp_method_name, attr_name_expr| generated_attribute_methods.module_eval <<-RUBY, __FILE__, __LINE__ + 1 + # frozen_string_literal: true def #{temp_method_name}(value) name = #{attr_name_expr} write_attribute(name, value) diff --git a/activerecord/lib/active_record/attribute_methods/read.rb b/activerecord/lib/active_record/attribute_methods/read.rb index 0f0e721b24..f8bc1b6110 100644 --- a/activerecord/lib/active_record/attribute_methods/read.rb +++ b/activerecord/lib/active_record/attribute_methods/read.rb @@ -12,6 +12,7 @@ module ActiveRecord generated_attribute_methods, name ) do |temp_method_name, attr_name_expr| generated_attribute_methods.module_eval <<-RUBY, __FILE__, __LINE__ + 1 + # frozen_string_literal: true def #{temp_method_name} name = #{attr_name_expr} _read_attribute(name) { |n| missing_attribute(n, caller) } diff --git a/activerecord/lib/active_record/attribute_methods/write.rb b/activerecord/lib/active_record/attribute_methods/write.rb index 66536a8ddf..937ca0e8aa 100644 --- a/activerecord/lib/active_record/attribute_methods/write.rb +++ b/activerecord/lib/active_record/attribute_methods/write.rb @@ -16,6 +16,7 @@ module ActiveRecord generated_attribute_methods, name, writer: true, ) do |temp_method_name, attr_name_expr| generated_attribute_methods.module_eval <<-RUBY, __FILE__, __LINE__ + 1 + # frozen_string_literal: true def #{temp_method_name}(value) name = #{attr_name_expr} _write_attribute(name, value) diff --git a/activestorage/lib/active_storage/attached/model.rb b/activestorage/lib/active_storage/attached/model.rb index 02018ae868..5072bb7de4 100644 --- a/activestorage/lib/active_storage/attached/model.rb +++ b/activestorage/lib/active_storage/attached/model.rb @@ -44,6 +44,7 @@ module ActiveStorage validate_service_configuration(name, service) generated_association_methods.class_eval <<-CODE, __FILE__, __LINE__ + 1 + # frozen_string_literal: true def #{name} @active_storage_attached_#{name} ||= ActiveStorage::Attached::One.new("#{name}", self) end @@ -113,6 +114,7 @@ module ActiveStorage validate_service_configuration(name, service) generated_association_methods.class_eval <<-CODE, __FILE__, __LINE__ + 1 + # frozen_string_literal: true def #{name} @active_storage_attached_#{name} ||= ActiveStorage::Attached::Many.new("#{name}", self) end