From 4f03190f262c07c1f389957ff7ae76901495d824 Mon Sep 17 00:00:00 2001 From: gbuesing Date: Thu, 8 May 2008 22:07:21 -0500 Subject: TimeWithZone: date part getter methods (#year #mon #day etc) are defined on class; no longer relying on method_missing --- activesupport/lib/active_support/time_with_zone.rb | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'activesupport/lib') diff --git a/activesupport/lib/active_support/time_with_zone.rb b/activesupport/lib/active_support/time_with_zone.rb index 461d52e40e..21ddcaad48 100644 --- a/activesupport/lib/active_support/time_with_zone.rb +++ b/activesupport/lib/active_support/time_with_zone.rb @@ -163,6 +163,14 @@ module ActiveSupport utc.advance(options).in_time_zone(time_zone) end + %w(year mon month day mday hour min sec).each do |method_name| + class_eval <<-EOV + def #{method_name} + time.#{method_name} + end + EOV + end + def usec time.respond_to?(:usec) ? time.usec : 0 end -- cgit v1.2.3