Changeset 3658
- Timestamp:
- 12/28/07 09:20:50 (5 years ago)
- Location:
- lang/ruby/date_time-smart
- Files:
-
- 2 modified
-
lib/date_time/smart.rb (modified) (2 diffs)
-
spec/date_time-smart_spec.rb (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
lang/ruby/date_time-smart/lib/date_time/smart.rb
r3655 r3658 14 14 end 15 15 16 def add n 17 case n 18 when Hash 19 return self + DateTime::Duration.new2(self, n) 20 end 21 __send__ :+, n 22 end 23 16 24 def -(n) 17 25 case n … … 22 30 end 23 31 return super 32 end 33 34 def subtract n 35 case n 36 when Hash 37 return self - DateTime::Duration.new2(self, n) 38 end 39 __send__ :-, n 24 40 end 25 41 end -
lang/ruby/date_time-smart/spec/date_time-smart_spec.rb
r3655 r3658 48 48 ( @birth_after_a_year_before_a_day - @dd ).should == @birth 49 49 end 50 51 it %{should add with DateTime::Duration.new2} do 52 @birth.add(:days => 364).should == @birth_after_a_year_before_a_day 53 @birth.add(:months => 11, :days => 30).should == @birth_after_a_year_before_a_day 54 @birth.add(:years => 1).subtract(:days => 1).should == @birth_after_a_year_before_a_day 55 end 50 56 end
![(please configure the [header_logo] section in trac.ini)](/share/chrome/site/your_project_logo.png)