Module: WeekDayCoreExt

Included in:
Date
Defined in:
lib/weekday.rb

Instance Method Summary collapse

Instance Method Details

#is_weekday?Boolean

Returns:

  • (Boolean)


2
3
4
# File 'lib/weekday.rb', line 2

def is_weekday?
  self.cwday < 6
end

#to_weekdayObject

Returns a Weekday. Doesn’t raise an exception if not a weekday, but returns the most previous weekday.



9
10
11
# File 'lib/weekday.rb', line 9

def to_weekday
  Weekday.civil(self.year, self.month, self.day)
end

#to_weekday!Object

Returns a Weekday. Raises Exception if not a weekday



15
16
17
# File 'lib/weekday.rb', line 15

def to_weekday!
  Weekday.civil!(self.year, self.month, self.day)
end