aboutsummaryrefslogtreecommitdiffstats
path: root/activesupport/lib/active_support/values
diff options
context:
space:
mode:
authorErnie Miller <ernie@metautonomo.us>2008-06-28 22:27:32 -0400
committergbuesing <gbuesing@gmail.com>2008-06-29 13:37:07 -0500
commitd0092dc44d580f4179308c7394d9023098406f79 (patch)
treed5ec77bbd249cd8bb1c1ae0efd877f179c656494 /activesupport/lib/active_support/values
parent029a7455846cde2654958358a6fe354f236ade35 (diff)
downloadrails-d0092dc44d580f4179308c7394d9023098406f79.tar.gz
rails-d0092dc44d580f4179308c7394d9023098406f79.tar.bz2
rails-d0092dc44d580f4179308c7394d9023098406f79.zip
Added support for regexp matching of priority zones in time_zone_select [#195 state:resolved]
Diffstat (limited to 'activesupport/lib/active_support/values')
-rw-r--r--activesupport/lib/active_support/values/time_zone.rb6
1 files changed, 6 insertions, 0 deletions
diff --git a/activesupport/lib/active_support/values/time_zone.rb b/activesupport/lib/active_support/values/time_zone.rb
index 5b2d42aa3c..788d40bfa8 100644
--- a/activesupport/lib/active_support/values/time_zone.rb
+++ b/activesupport/lib/active_support/values/time_zone.rb
@@ -201,6 +201,12 @@ module ActiveSupport
result
end
+ # Compare #name and TZInfo identifier to a supplied regexp, returning true
+ # if a match is found.
+ def =~(re)
+ return true if name =~ re || MAPPING[name] =~ re
+ end
+
# Returns a textual representation of this time zone.
def to_s
"(GMT#{formatted_offset}) #{name}"