Skip to content

Commit

Permalink
Simplified month_days method
Browse files Browse the repository at this point in the history
  • Loading branch information
citizen428 committed Jun 17, 2010
1 parent 4d210f1 commit 2bf18e0
Showing 1 changed file with 2 additions and 3 deletions.
5 changes: 2 additions & 3 deletions coreruby/exercise_set8/e0803month_days.rb
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,8 @@

require 'Date'

# see documentation for 'Date#<<' if you don't understand this
def month_days(month=1, year=Time.now.year)
(Date.new(year,12,31)<<12-month).day
def month_days(month, year=Time.now.year)
Date.new(year,month,-1).day
end

# tests
Expand Down

0 comments on commit 2bf18e0

Please sign in to comment.