diff options
Diffstat (limited to 'activesupport/lib/active_support/time_with_zone.rb')
-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) |