aboutsummaryrefslogtreecommitdiffstats
path: root/activesupport
diff options
context:
space:
mode:
authorErik Michaels-Ober <sferik@gmail.com>2014-09-29 16:07:18 +0200
committerErik Michaels-Ober <sferik@gmail.com>2014-09-29 17:27:10 +0200
commite2b49b203f2cb6cef93283f14838f21bf6ffb4a2 (patch)
tree14d3101aca1464d140a824e6c859cecef425bfc8 /activesupport
parent3b451fc0fd4a507016b5a6fe61bb4a8ae388c099 (diff)
downloadrails-e2b49b203f2cb6cef93283f14838f21bf6ffb4a2.tar.gz
rails-e2b49b203f2cb6cef93283f14838f21bf6ffb4a2.tar.bz2
rails-e2b49b203f2cb6cef93283f14838f21bf6ffb4a2.zip
Use Hash#each_key instead of Hash#keys.each
Hash#keys.each allocates an array of keys; Hash#each_key iterates through the keys without allocating a new array. This is the reason why Hash#each_key exists.
Diffstat (limited to 'activesupport')
-rw-r--r--activesupport/test/time_zone_test.rb2
1 files changed, 1 insertions, 1 deletions
diff --git a/activesupport/test/time_zone_test.rb b/activesupport/test/time_zone_test.rb
index b7a89ed332..3e6d9652bb 100644
--- a/activesupport/test/time_zone_test.rb
+++ b/activesupport/test/time_zone_test.rb
@@ -22,7 +22,7 @@ class TimeZoneTest < ActiveSupport::TestCase
assert_instance_of TZInfo::TimezonePeriod, zone.period_for_local(Time.utc(2000))
end
- ActiveSupport::TimeZone::MAPPING.keys.each do |name|
+ ActiveSupport::TimeZone::MAPPING.each_key do |name|
define_method("test_map_#{name.downcase.gsub(/[^a-z]/, '_')}_to_tzinfo") do
zone = ActiveSupport::TimeZone[name]
assert_respond_to zone.tzinfo, :period_for_local