Class: Time
- Inherits:
-
Object
- Object
- Time
- Defined in:
- lib/entity/time.rb
Overview
Extension of the ruby Time class to provide necessary operations on a Time object
Class Method Summary collapse
-
.days_in_month(year, month) ⇒ Integer
singleton method to determine the number of days for the actual month and year.
Instance Method Summary collapse
-
#get_int_wday ⇒ Integer
determines the day of the week, with a week starting on monday and ending on sunday and values in [0,6] monday == 0 …
-
#next_month ⇒ Time
determines the start of the next month, based on the actual value.
Class Method Details
.days_in_month(year, month) ⇒ Integer
singleton method to determine the number of days for the actual month and year
19 20 21 |
# File 'lib/entity/time.rb', line 19 def self.days_in_month(year, month) Date.new(year, month, -1).day end |
Instance Method Details
#get_int_wday ⇒ Integer
determines the day of the week, with a week starting on monday and ending on sunday and values in [0,6]
monday == 0
...
sunday == 6
29 30 31 32 33 |
# File 'lib/entity/time.rb', line 29 def get_int_wday int_wday = self.wday - 1 return int_wday if (int_wday >= 0) return 6 end |