Changeset 8886
- Timestamp:
- 02/17/08 00:35:49 (7 months ago)
- Files:
-
- trunk/activesupport/CHANGELOG (modified) (1 diff)
- trunk/activesupport/lib/active_support/time_with_zone.rb (modified) (2 diffs)
- trunk/activesupport/test/core_ext/time_with_zone_test.rb (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
trunk/activesupport/CHANGELOG
r8885 r8886 1 1 *SVN* 2 3 * Adding TimeWithZone#between? [Geoff Buesing] 2 4 3 5 * Time.=== returns true for TimeWithZone instances [Geoff Buesing] trunk/activesupport/lib/active_support/time_with_zone.rb
r8884 r8886 124 124 def <=>(other) 125 125 utc <=> other 126 end 127 128 def between?(min, max) 129 utc.between?(min, max) 126 130 end 127 131 … … 161 165 alias_method :tv_sec, :to_i 162 166 163 # A Time Proxyacts like a Time, so just return self167 # A TimeWithZone acts like a Time, so just return self 164 168 def to_time 165 169 self trunk/activesupport/test/core_ext/time_with_zone_test.rb
r8884 r8886 115 115 assert_equal 0, @twz <=> ActiveSupport::TimeWithZone.new( Time.utc(2000, 1, 1, 0, 0, 0), TimeZone['UTC'] ) 116 116 assert_equal(-1, @twz <=> ActiveSupport::TimeWithZone.new( Time.utc(2000, 1, 1, 0, 0, 1), TimeZone['UTC'] )) 117 end 118 119 def test_between? 120 assert @twz.between?(Time.utc(1999,12,31,23,59,59), Time.utc(2000,1,1,0,0,1)) 121 assert_equal false, @twz.between?(Time.utc(2000,1,1,0,0,1), Time.utc(2000,1,1,0,0,2)) 117 122 end 118 123