aboutsummaryrefslogtreecommitdiffstats
path: root/activesupport/lib/active_support/core_ext/time
diff options
context:
space:
mode:
authorGeoff Buesing <gbuesing@gmail.com>2008-02-10 19:02:30 +0000
committerGeoff Buesing <gbuesing@gmail.com>2008-02-10 19:02:30 +0000
commitb9be374ddd2142ca53da3c235e35ccbb70c66842 (patch)
tree4a1ca7fd3a93903795a71a8201e2c44d8a108695 /activesupport/lib/active_support/core_ext/time
parentdb4fc6f206f83d8981e006c80f08bfd4bff02e87 (diff)
downloadrails-b9be374ddd2142ca53da3c235e35ccbb70c66842.tar.gz
rails-b9be374ddd2142ca53da3c235e35ccbb70c66842.tar.bz2
rails-b9be374ddd2142ca53da3c235e35ccbb70c66842.zip
Time#zone=, #in_time_zone and #change_time_zone accept a Duration
git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@8850 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
Diffstat (limited to 'activesupport/lib/active_support/core_ext/time')
-rw-r--r--activesupport/lib/active_support/core_ext/time/zones.rb3
1 files changed, 2 insertions, 1 deletions
diff --git a/activesupport/lib/active_support/core_ext/time/zones.rb b/activesupport/lib/active_support/core_ext/time/zones.rb
index 18af28edc8..1fab89be48 100644
--- a/activesupport/lib/active_support/core_ext/time/zones.rb
+++ b/activesupport/lib/active_support/core_ext/time/zones.rb
@@ -38,7 +38,8 @@ module ActiveSupport #:nodoc:
private
def get_zone(time_zone)
- ::String === time_zone || ::Numeric === time_zone ? TimeZone[time_zone] : time_zone
+ return time_zone if time_zone.nil? || time_zone.respond_to?(:period_for_local)
+ TimeZone[time_zone]
end
end