Class: SplitTime::Months
- Inherits:
-
Object
- Object
- SplitTime::Months
- Defined in:
- lib/split_time/months.rb
Constant Summary collapse
- COMMON_YEAR_DAYS_IN_MONTH =
[nil, 31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31]
Class Method Summary collapse
Class Method Details
.all ⇒ Object
5 6 7 |
# File 'lib/split_time/months.rb', line 5 def self.all [nil, 'Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'July', 'Aug', 'Sept', 'Oct' , 'Nov', 'Dec'] end |
.days_in_month(month, year = Time.now.year) ⇒ Object
9 10 11 12 |
# File 'lib/split_time/months.rb', line 9 def self.days_in_month(month, year = Time.now.year) return 29 if month == 2 && Date.gregorian_leap?(year) COMMON_YEAR_DAYS_IN_MONTH[month] end |