From d77deb89d54b18c662ae3de103802e4d7a9d7d08 Mon Sep 17 00:00:00 2001 From: "Michael S. Klishin" Date: Sun, 28 Dec 2008 13:21:10 +0300 Subject: Annotated metaprogramming code across ActiveSupport --- activesupport/lib/active_support/time_with_zone.rb | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'activesupport/lib/active_support/time_with_zone.rb') diff --git a/activesupport/lib/active_support/time_with_zone.rb b/activesupport/lib/active_support/time_with_zone.rb index 9a2d283b30..59f1e6163b 100644 --- a/activesupport/lib/active_support/time_with_zone.rb +++ b/activesupport/lib/active_support/time_with_zone.rb @@ -233,10 +233,10 @@ module ActiveSupport end %w(year mon month day mday wday yday hour min sec to_date).each do |method_name| - class_eval <<-EOV - def #{method_name} - time.#{method_name} - end + class_eval <<-EOV, __FILE__, __LINE__ + 1 + def #{method_name} # def month + time.#{method_name} # time.month + end # end EOV end -- cgit v1.2.3 From db619c4a4115d5eeca9473f8f77f34c877e4e1dd Mon Sep 17 00:00:00 2001 From: Yehuda Katz Date: Mon, 5 Jan 2009 01:10:55 -0800 Subject: Sync 'rails/rails/master' --- activesupport/lib/active_support/time_with_zone.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'activesupport/lib/active_support/time_with_zone.rb') diff --git a/activesupport/lib/active_support/time_with_zone.rb b/activesupport/lib/active_support/time_with_zone.rb index 59f1e6163b..51939e1d01 100644 --- a/activesupport/lib/active_support/time_with_zone.rb +++ b/activesupport/lib/active_support/time_with_zone.rb @@ -199,7 +199,7 @@ module ActiveSupport # If we're subtracting a Duration of variable length (i.e., years, months, days), move backwards from #time, # otherwise move backwards #utc, for accuracy when moving across DST boundaries if other.acts_like?(:time) - utc - other + utc.to_f - other.to_f elsif duration_of_variable_length?(other) method_missing(:-, other) else -- cgit v1.2.3 From c00f2d25de640b8de1c8583474085f3836ee1768 Mon Sep 17 00:00:00 2001 From: Geoff Buesing Date: Sun, 5 Apr 2009 10:08:54 -0500 Subject: TimeWithZone.name returns 'Time', to further thwart type checking --- activesupport/lib/active_support/time_with_zone.rb | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'activesupport/lib/active_support/time_with_zone.rb') diff --git a/activesupport/lib/active_support/time_with_zone.rb b/activesupport/lib/active_support/time_with_zone.rb index 518ca7742f..2574f4e88e 100644 --- a/activesupport/lib/active_support/time_with_zone.rb +++ b/activesupport/lib/active_support/time_with_zone.rb @@ -31,6 +31,11 @@ module ActiveSupport # t.is_a?(Time) # => true # t.is_a?(ActiveSupport::TimeWithZone) # => true class TimeWithZone + + def self.name + 'Time' # Report class name as 'Time' to thwart type checking + end + include Comparable attr_reader :time_zone -- cgit v1.2.3