Class: MonthRange::Month
- Inherits:
-
Date
- Object
- Date
- MonthRange::Month
- Defined in:
- lib/month_range/month.rb
Defined Under Namespace
Classes: Infinity, InvalidMonthFormat
Class Method Summary collapse
Instance Method Summary collapse
Class Method Details
.create(date) ⇒ Object
10 11 12 13 14 15 16 |
# File 'lib/month_range/month.rb', line 10 def self.create(date) return MonthRange::Month::Infinity.new if date.nil? raise InvalidMonthFormat unless date.is_a?(Date) raise InvalidMonthFormat unless date.mday == 1 new(date.year, date.month, date.mday) end |
Instance Method Details
#infinite? ⇒ Boolean
22 23 24 |
# File 'lib/month_range/month.rb', line 22 def infinite? false end |
#to_date ⇒ Object
18 19 20 |
# File 'lib/month_range/month.rb', line 18 def to_date Date.new(year, month, mday) end |