aboutsummaryrefslogtreecommitdiffstats
path: root/activesupport/lib/active_support/values
diff options
context:
space:
mode:
authorMartin Eisenhardt <martin.eisenhardt@mneisen.org>2008-05-15 09:21:43 -0500
committerJoshua Peek <josh@joshpeek.com>2008-05-15 09:22:44 -0500
commitfc02eabf296d6edb74a95174c7322293a54c9492 (patch)
treed331bf73859ca4f5236e46dd13d6115506c85719 /activesupport/lib/active_support/values
parent802034ff5f1c3e3b576b664d5660e76c8f44909d (diff)
downloadrails-fc02eabf296d6edb74a95174c7322293a54c9492.tar.gz
rails-fc02eabf296d6edb74a95174c7322293a54c9492.tar.bz2
rails-fc02eabf296d6edb74a95174c7322293a54c9492.zip
Precompute TimeZone.us_zones [#199 state:resolved]
Signed-off-by: Joshua Peek <josh@joshpeek.com>
Diffstat (limited to 'activesupport/lib/active_support/values')
-rw-r--r--activesupport/lib/active_support/values/time_zone.rb9
1 files changed, 4 insertions, 5 deletions
diff --git a/activesupport/lib/active_support/values/time_zone.rb b/activesupport/lib/active_support/values/time_zone.rb
index 0fa99135e2..f522b64108 100644
--- a/activesupport/lib/active_support/values/time_zone.rb
+++ b/activesupport/lib/active_support/values/time_zone.rb
@@ -325,6 +325,9 @@ class TimeZone
ZONES.sort!
ZONES.freeze
ZONES_MAP.freeze
+
+ US_ZONES = ZONES.find_all { |z| z.name =~ /US|Arizona|Indiana|Hawaii|Alaska/ }
+ US_ZONES.freeze
end
class << self
@@ -361,14 +364,10 @@ class TimeZone
end
end
- # A regular expression that matches the names of all time zones in
- # the USA.
- US_ZONES = /US|Arizona|Indiana|Hawaii|Alaska/.freeze
-
# A convenience method for returning a collection of TimeZone objects
# for time zones in the USA.
def us_zones
- all.find_all { |z| z.name =~ US_ZONES }
+ US_ZONES
end
end
end