Replace Enumerable#reverse.each with Enumerable#reverse_each

This commit is contained in:
Erik Michaels-Ober 2014-10-13 11:47:16 +01:00
parent 996aab576e
commit 8bb33e920a
5 changed files with 6 additions and 6 deletions

View File

@ -1035,7 +1035,7 @@ module ActionView
def build_selects_from_types(order)
select = ''
first_visible = order.find { |type| !@options[:"discard_#{type}"] }
order.reverse.each do |type|
order.reverse_each do |type|
separator = separator(type) unless type == first_visible # don't add before first visible field
select.insert(0, separator.to_s + send("select_#{type}").to_s)
end

View File

@ -19,7 +19,7 @@ class SchemaDumperTest < ActiveRecord::TestCase
def test_dump_schema_information_outputs_lexically_ordered_versions
versions = %w{ 20100101010101 20100201010101 20100301010101 }
versions.reverse.each do |v|
versions.reverse_each do |v|
ActiveRecord::SchemaMigration.create!(:version => v)
end

View File

@ -559,7 +559,7 @@ module ActiveSupport
# This is used internally to append, prepend and skip callbacks to the
# CallbackChain.
def __update_callbacks(name) #:nodoc:
([self] + ActiveSupport::DescendantsTracker.descendants(self)).reverse.each do |target|
([self] + ActiveSupport::DescendantsTracker.descendants(self)).reverse_each do |target|
chain = target.get_callbacks name
yield target, chain.dup
end

View File

@ -490,8 +490,8 @@ class InflectorTest < ActiveSupport::TestCase
assert_equal [], inflect.uncountables
# restore all the inflections
singulars.reverse.each { |singular| inflect.singular(*singular) }
plurals.reverse.each { |plural| inflect.plural(*plural) }
singulars.reverse_each { |singular| inflect.singular(*singular) }
plurals.reverse_each { |plural| inflect.plural(*plural) }
inflect.uncountable(uncountables)
assert_equal singulars, inflect.singulars

View File

@ -12,7 +12,7 @@ module Rails
def add_routes
unless options[:skip_routes]
actions.reverse.each do |action|
actions.reverse_each do |action|
route generate_routing_code(action)
end
end