lib/modules/week.rb
# it returns date of the previous week day.
# Date.new(2012,11,15).previous_week
#   => #<Date: 2012-11-08 ((2456240j,0s,0n),+0s,2299161j)>
# Time.new(2012,11,30).previous_week
#   => 2012-11-29 23:59:53 +0530
# @return [Date || Time]
it returns date of the previous week day.
it returns date of the previous week day .
def previous_week
      if self.class == Date
        self - 7
      elsif self.class == Time
        self - (60 * 60 * 24 * 7)
      end
    end
def previous_week if self . class == Date self - 7 elsif self . class == Time self - ( 60 * 60 * 24 * 7 ) end end
it returns date of the previous week day.
it returns date of the previous week day .
None
Date || Time