diff options
author | Geoff Buesing <gbuesing@gmail.com> | 2008-03-28 01:57:41 +0000 |
---|---|---|
committer | Geoff Buesing <gbuesing@gmail.com> | 2008-03-28 01:57:41 +0000 |
commit | e4645e00b7a427f32e470b4ad3fe494b698f725d (patch) | |
tree | 0722ca35306af6400f79f6b28a022e3a5aae90ee /activesupport/lib | |
parent | 480a7581d4ec87eb745b004d6e4daae98b52cfa5 (diff) | |
download | rails-e4645e00b7a427f32e470b4ad3fe494b698f725d.tar.gz rails-e4645e00b7a427f32e470b4ad3fe494b698f725d.tar.bz2 rails-e4645e00b7a427f32e470b4ad3fe494b698f725d.zip |
TimeWithZone#usec returns 0 instead of error when DateTime is wrapped
git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@9105 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
Diffstat (limited to 'activesupport/lib')
-rw-r--r-- | activesupport/lib/active_support/time_with_zone.rb | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/activesupport/lib/active_support/time_with_zone.rb b/activesupport/lib/active_support/time_with_zone.rb index 56c4f40f32..3c37ab2d4c 100644 --- a/activesupport/lib/active_support/time_with_zone.rb +++ b/activesupport/lib/active_support/time_with_zone.rb @@ -143,7 +143,7 @@ module ActiveSupport end end - %w(asctime day hour min mon sec usec wday yday year to_date).each do |name| + %w(asctime day hour min mon sec wday yday year to_date).each do |name| define_method(name) do time.__send__(name) end @@ -152,6 +152,10 @@ module ActiveSupport alias_method :mday, :day alias_method :month, :mon + def usec + time.respond_to?(:usec) ? time.usec : 0 + end + %w(sunday? monday? tuesday? wednesday? thursday? friday? saturday?).each do |name| define_method(name) do time.__send__(name) |