提交 7c70430c 编写于 作者: R Ryuta Kamizono

Fix broken heredoc indentation caused by rubocop auto-correct

All indentation was normalized by rubocop auto-correct at 80e66cc4.
But heredocs was still kept absolute position. This commit aligns
heredocs indentation for consistency.
上级 f2f00ca5
...@@ -663,14 +663,14 @@ def kwarg_request?(args) ...@@ -663,14 +663,14 @@ def kwarg_request?(args)
def non_kwarg_request_warning def non_kwarg_request_warning
ActiveSupport::Deprecation.warn(<<-MSG.strip_heredoc) ActiveSupport::Deprecation.warn(<<-MSG.strip_heredoc)
ActionController::TestCase HTTP request methods will accept only ActionController::TestCase HTTP request methods will accept only
keyword arguments in future Rails versions. keyword arguments in future Rails versions.
Examples: Examples:
get :show, params: { id: 1 }, session: { user_id: 1 } get :show, params: { id: 1 }, session: { user_id: 1 }
process :update, method: :post, params: { id: 1 } process :update, method: :post, params: { id: 1 }
MSG MSG
end end
def document_root_element def document_root_element
......
...@@ -26,7 +26,7 @@ def to_dot ...@@ -26,7 +26,7 @@ def to_dot
node [shape = circle]; node [shape = circle];
#{edges.join "\n"} #{edges.join "\n"}
} }
eodot eodot
end end
end end
end end
......
...@@ -119,7 +119,7 @@ def get_class(klass) ...@@ -119,7 +119,7 @@ def get_class(klass)
"#{klass}" => #{converted_klass} "#{klass}" => #{converted_klass}
eowarn eowarn
converted_klass converted_klass
else else
klass klass
......
...@@ -290,11 +290,12 @@ def _write_layout_method # :nodoc: ...@@ -290,11 +290,12 @@ def _write_layout_method # :nodoc:
RUBY RUBY
end end
layout_definition = case _layout layout_definition = \
when String case _layout
_layout.inspect when String
when Symbol _layout.inspect
<<-RUBY when Symbol
<<-RUBY
#{_layout}.tap do |layout| #{_layout}.tap do |layout|
return #{default_behavior} if layout.nil? return #{default_behavior} if layout.nil?
unless layout.is_a?(String) || !layout unless layout.is_a?(String) || !layout
...@@ -303,21 +304,21 @@ def _write_layout_method # :nodoc: ...@@ -303,21 +304,21 @@ def _write_layout_method # :nodoc:
end end
end end
RUBY RUBY
when Proc when Proc
define_method :_layout_from_proc, &_layout define_method :_layout_from_proc, &_layout
protected :_layout_from_proc protected :_layout_from_proc
<<-RUBY <<-RUBY
result = _layout_from_proc(#{_layout.arity == 0 ? '' : 'self'}) result = _layout_from_proc(#{_layout.arity == 0 ? '' : 'self'})
return #{default_behavior} if result.nil? return #{default_behavior} if result.nil?
result result
RUBY RUBY
when false when false
nil nil
when true when true
raise ArgumentError, "Layouts must be specified as a String, Symbol, Proc, false, or nil" raise ArgumentError, "Layouts must be specified as a String, Symbol, Proc, false, or nil"
when nil when nil
name_clause name_clause
end end
self.class_eval <<-RUBY, __FILE__, __LINE__ + 1 self.class_eval <<-RUBY, __FILE__, __LINE__ + 1
def _layout(formats) def _layout(formats)
......
...@@ -1810,12 +1810,12 @@ def has_and_belongs_to_many(name, scope = nil, **options, &extension) ...@@ -1810,12 +1810,12 @@ def has_and_belongs_to_many(name, scope = nil, **options, &extension)
include Module.new { include Module.new {
class_eval <<-RUBY, __FILE__, __LINE__ + 1 class_eval <<-RUBY, __FILE__, __LINE__ + 1
def destroy_associations def destroy_associations
association(:#{middle_reflection.name}).delete_all(:delete_all) association(:#{middle_reflection.name}).delete_all(:delete_all)
association(:#{name}).reset association(:#{name}).reset
super super
end end
RUBY RUBY
} }
hm_options = {} hm_options = {}
......
...@@ -130,10 +130,10 @@ def suppress_composite_primary_key(pk) ...@@ -130,10 +130,10 @@ def suppress_composite_primary_key(pk)
return pk unless pk.is_a?(Array) return pk unless pk.is_a?(Array)
warn <<-WARNING.strip_heredoc warn <<-WARNING.strip_heredoc
WARNING: Active Record does not support composite primary key. WARNING: Active Record does not support composite primary key.
#{table_name} has composite primary key. Composite primary key is ignored. #{table_name} has composite primary key. Composite primary key is ignored.
WARNING WARNING
end end
end end
end end
......
...@@ -31,11 +31,11 @@ def define_method_attribute(name) ...@@ -31,11 +31,11 @@ def define_method_attribute(name)
ActiveRecord::AttributeMethods::AttrNames.set_name_cache safe_name, name ActiveRecord::AttributeMethods::AttrNames.set_name_cache safe_name, name
generated_attribute_methods.module_eval <<-STR, __FILE__, __LINE__ + 1 generated_attribute_methods.module_eval <<-STR, __FILE__, __LINE__ + 1
def #{temp_method} def #{temp_method}
name = ::ActiveRecord::AttributeMethods::AttrNames::ATTR_#{safe_name} name = ::ActiveRecord::AttributeMethods::AttrNames::ATTR_#{safe_name}
_read_attribute(name) { |n| missing_attribute(n, caller) } _read_attribute(name) { |n| missing_attribute(n, caller) }
end end
STR STR
generated_attribute_methods.module_eval do generated_attribute_methods.module_eval do
alias_method name, temp_method alias_method name, temp_method
......
...@@ -94,18 +94,18 @@ def create_time_zone_conversion_attribute?(name, cast_type) ...@@ -94,18 +94,18 @@ def create_time_zone_conversion_attribute?(name, cast_type)
cast_type.type == :time && cast_type.type == :time &&
time_zone_aware_types.include?(:not_explicitly_configured) time_zone_aware_types.include?(:not_explicitly_configured)
ActiveSupport::Deprecation.warn(<<-MESSAGE.strip_heredoc) ActiveSupport::Deprecation.warn(<<-MESSAGE.strip_heredoc)
Time columns will become time zone aware in Rails 5.1. This Time columns will become time zone aware in Rails 5.1. This
still causes `String`s to be parsed as if they were in `Time.zone`, still causes `String`s to be parsed as if they were in `Time.zone`,
and `Time`s to be converted to `Time.zone`. and `Time`s to be converted to `Time.zone`.
To keep the old behavior, you must add the following to your initializer: To keep the old behavior, you must add the following to your initializer:
config.active_record.time_zone_aware_types = [:datetime] config.active_record.time_zone_aware_types = [:datetime]
To silence this deprecation warning, add the following: To silence this deprecation warning, add the following:
config.active_record.time_zone_aware_types = [:datetime, :time] config.active_record.time_zone_aware_types = [:datetime, :time]
MESSAGE MESSAGE
end end
result result
......
...@@ -15,13 +15,13 @@ def define_method_attribute=(name) ...@@ -15,13 +15,13 @@ def define_method_attribute=(name)
ActiveRecord::AttributeMethods::AttrNames.set_name_cache safe_name, name ActiveRecord::AttributeMethods::AttrNames.set_name_cache safe_name, name
generated_attribute_methods.module_eval <<-STR, __FILE__, __LINE__ + 1 generated_attribute_methods.module_eval <<-STR, __FILE__, __LINE__ + 1
def __temp__#{safe_name}=(value) def __temp__#{safe_name}=(value)
name = ::ActiveRecord::AttributeMethods::AttrNames::ATTR_#{safe_name} name = ::ActiveRecord::AttributeMethods::AttrNames::ATTR_#{safe_name}
write_attribute(name, value) write_attribute(name, value)
end end
alias_method #{(name + '=').inspect}, :__temp__#{safe_name}= alias_method #{(name + '=').inspect}, :__temp__#{safe_name}=
undef_method :__temp__#{safe_name}= undef_method :__temp__#{safe_name}=
STR STR
end end
end end
......
...@@ -63,10 +63,10 @@ def valid? ...@@ -63,10 +63,10 @@ def valid?
def define def define
model.class_eval <<-CODE, __FILE__, __LINE__ + 1 model.class_eval <<-CODE, __FILE__, __LINE__ + 1
def self.#{name}(#{signature}) def self.#{name}(#{signature})
#{body} #{body}
end end
CODE CODE
end end
private private
......
...@@ -125,10 +125,10 @@ module StraightReversions ...@@ -125,10 +125,10 @@ module StraightReversions
}.each do |cmd, inv| }.each do |cmd, inv|
[[inv, cmd], [cmd, inv]].uniq.each do |method, inverse| [[inv, cmd], [cmd, inv]].uniq.each do |method, inverse|
class_eval <<-EOV, __FILE__, __LINE__ + 1 class_eval <<-EOV, __FILE__, __LINE__ + 1
def invert_#{method}(args, &block) # def invert_create_table(args, &block) def invert_#{method}(args, &block) # def invert_create_table(args, &block)
[:#{inverse}, args, block] # [:drop_table, args, block] [:#{inverse}, args, block] # [:drop_table, args, block]
end # end end # end
EOV EOV
end end
end end
end end
......
...@@ -354,13 +354,13 @@ def accepts_nested_attributes_for(*attr_names) ...@@ -354,13 +354,13 @@ def accepts_nested_attributes_for(*attr_names)
# associations are just regular associations. # associations are just regular associations.
def generate_association_writer(association_name, type) def generate_association_writer(association_name, type)
generated_association_methods.module_eval <<-eoruby, __FILE__, __LINE__ + 1 generated_association_methods.module_eval <<-eoruby, __FILE__, __LINE__ + 1
if method_defined?(:#{association_name}_attributes=) if method_defined?(:#{association_name}_attributes=)
remove_method(:#{association_name}_attributes=) remove_method(:#{association_name}_attributes=)
end end
def #{association_name}_attributes=(attributes) def #{association_name}_attributes=(attributes)
assign_nested_attributes_for_#{type}_association(:#{association_name}, attributes) assign_nested_attributes_for_#{type}_association(:#{association_name}, attributes)
end end
eoruby eoruby
end end
end end
......
...@@ -466,9 +466,9 @@ def find_one(id) ...@@ -466,9 +466,9 @@ def find_one(id)
if ActiveRecord::Base === id if ActiveRecord::Base === id
id = id.id id = id.id
ActiveSupport::Deprecation.warn(<<-MSG.squish) ActiveSupport::Deprecation.warn(<<-MSG.squish)
You are passing an instance of ActiveRecord::Base to `find`. You are passing an instance of ActiveRecord::Base to `find`.
Please pass the id of the object by calling `.id`. Please pass the id of the object by calling `.id`.
MSG MSG
end end
relation = where(primary_key => id) relation = where(primary_key => id)
......
...@@ -18,9 +18,9 @@ def call(attribute, value) ...@@ -18,9 +18,9 @@ def call(attribute, value)
def print_deprecation_warning def print_deprecation_warning
ActiveSupport::Deprecation.warn(<<-MSG.squish) ActiveSupport::Deprecation.warn(<<-MSG.squish)
Passing a class as a value in an Active Record query is deprecated and Passing a class as a value in an Active Record query is deprecated and
will be removed. Pass a string instead. will be removed. Pass a string instead.
MSG MSG
end end
end end
end end
......
...@@ -105,7 +105,7 @@ def grant_statement ...@@ -105,7 +105,7 @@ def grant_statement
GRANT ALL PRIVILEGES ON #{configuration['database']}.* GRANT ALL PRIVILEGES ON #{configuration['database']}.*
TO '#{configuration['username']}'@'localhost' TO '#{configuration['username']}'@'localhost'
IDENTIFIED BY '#{configuration['password']}' WITH GRANT OPTION; IDENTIFIED BY '#{configuration['password']}' WITH GRANT OPTION;
SQL SQL
end end
def root_configuration_without_database def root_configuration_without_database
......
...@@ -26,9 +26,9 @@ def teardown ...@@ -26,9 +26,9 @@ def teardown
def num_indices_named(name) def num_indices_named(name)
@connection.execute(<<-SQL).values.length @connection.execute(<<-SQL).values.length
SELECT 1 FROM "pg_index" SELECT 1 FROM "pg_index"
JOIN "pg_class" ON "pg_index"."indexrelid" = "pg_class"."oid" JOIN "pg_class" ON "pg_index"."indexrelid" = "pg_class"."oid"
WHERE "pg_class"."relname" = '#{name}' WHERE "pg_class"."relname" = '#{name}'
SQL SQL
end end
end end
...@@ -431,9 +431,9 @@ def assert_logged(logs) ...@@ -431,9 +431,9 @@ def assert_logged(logs)
def with_example_table(definition = nil, table_name = "ex", &block) def with_example_table(definition = nil, table_name = "ex", &block)
definition ||= <<-SQL definition ||= <<-SQL
id integer PRIMARY KEY AUTOINCREMENT, id integer PRIMARY KEY AUTOINCREMENT,
number integer number integer
SQL SQL
super(@conn, table_name, definition, &block) super(@conn, table_name, definition, &block)
end end
end end
......
...@@ -1003,10 +1003,10 @@ def time_related_columns_on_topic ...@@ -1003,10 +1003,10 @@ def time_related_columns_on_topic
def privatize(method_signature) def privatize(method_signature)
@target.class_eval(<<-private_method, __FILE__, __LINE__ + 1) @target.class_eval(<<-private_method, __FILE__, __LINE__ + 1)
private private
def #{method_signature} def #{method_signature}
"I'm private" "I'm private"
end end
private_method private_method
end end
end end
...@@ -310,10 +310,10 @@ def test_update_all_goes_through_normal_type_casting ...@@ -310,10 +310,10 @@ def test_update_all_goes_through_normal_type_casting
def skip_if_sqlite3_version_includes_quoting_bug def skip_if_sqlite3_version_includes_quoting_bug
if sqlite3_version_includes_quoting_bug? if sqlite3_version_includes_quoting_bug?
skip <<-ERROR.squish skip <<-ERROR.squish
You are using an outdated version of SQLite3 which has a bug in You are using an outdated version of SQLite3 which has a bug in
quoted column names. Please update SQLite3 and rebuild the sqlite3 quoted column names. Please update SQLite3 and rebuild the sqlite3
ruby gem ruby gem
ERROR ERROR
end end
end end
......
...@@ -100,9 +100,9 @@ class Paperback < ActiveRecord::Base; end ...@@ -100,9 +100,9 @@ class Paperback < ActiveRecord::Base; end
setup do setup do
@connection = ActiveRecord::Base.connection @connection = ActiveRecord::Base.connection
@connection.execute <<-SQL @connection.execute <<-SQL
CREATE VIEW paperbacks CREATE VIEW paperbacks
AS SELECT name, status FROM books WHERE format = 'paperback' AS SELECT name, status FROM books WHERE format = 'paperback'
SQL SQL
end end
teardown do teardown do
...@@ -162,9 +162,9 @@ class PrintedBook < ActiveRecord::Base ...@@ -162,9 +162,9 @@ class PrintedBook < ActiveRecord::Base
setup do setup do
@connection = ActiveRecord::Base.connection @connection = ActiveRecord::Base.connection
@connection.execute <<-SQL @connection.execute <<-SQL
CREATE VIEW printed_books CREATE VIEW printed_books
AS SELECT id, name, status, format FROM books WHERE format = 'paperback' AS SELECT id, name, status, format FROM books WHERE format = 'paperback'
SQL SQL
end end
teardown do teardown do
......
...@@ -297,9 +297,9 @@ class Callback #:nodoc:# ...@@ -297,9 +297,9 @@ class Callback #:nodoc:#
def self.build(chain, filter, kind, options) def self.build(chain, filter, kind, options)
if filter.is_a?(String) if filter.is_a?(String)
ActiveSupport::Deprecation.warn(<<-MSG.squish) ActiveSupport::Deprecation.warn(<<-MSG.squish)
Passing string to define callback is deprecated and will be removed Passing string to define callback is deprecated and will be removed
in Rails 5.1 without replacement. in Rails 5.1 without replacement.
MSG MSG
end end
new chain.name, filter, kind, options, chain.config new chain.name, filter, kind, options, chain.config
...@@ -751,10 +751,10 @@ def define_callbacks(*names) ...@@ -751,10 +751,10 @@ def define_callbacks(*names)
set_callbacks name, CallbackChain.new(name, options) set_callbacks name, CallbackChain.new(name, options)
module_eval <<-RUBY, __FILE__, __LINE__ + 1 module_eval <<-RUBY, __FILE__, __LINE__ + 1
def _run_#{name}_callbacks(&block) def _run_#{name}_callbacks(&block)
__run_callbacks__(_#{name}_callbacks, &block) __run_callbacks__(_#{name}_callbacks, &block)
end end
RUBY RUBY
end end
end end
...@@ -787,9 +787,9 @@ def deprecated_false_terminator # :nodoc: ...@@ -787,9 +787,9 @@ def deprecated_false_terminator # :nodoc:
def display_deprecation_warning_for_false_terminator def display_deprecation_warning_for_false_terminator
ActiveSupport::Deprecation.warn(<<-MSG.squish) ActiveSupport::Deprecation.warn(<<-MSG.squish)
Returning `false` in Active Record and Active Model callbacks will not implicitly halt a callback chain in Rails 5.1. Returning `false` in Active Record and Active Model callbacks will not implicitly halt a callback chain in Rails 5.1.
To explicitly halt the callback chain, please use `throw :abort` instead. To explicitly halt the callback chain, please use `throw :abort` instead.
MSG MSG
end end
end end
end end
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册