Class: Montrose::MonthDay
- Inherits:
-
Object
- Object
- Montrose::MonthDay
- Defined in:
- lib/montrose/month_day.rb
Constant Summary collapse
- MDAYS =
(-31.upto(-1).to_a + 1.upto(31).to_a)
Class Method Summary collapse
Class Method Details
.assert(number) ⇒ Object
17 18 19 20 21 22 |
# File 'lib/montrose/month_day.rb', line 17 def assert(number) test = number.abs raise ConfigurationError, "Out of range: #{MDAYS.inspect} does not include #{test}" unless MDAYS.include?(number.abs) number end |
.parse(mdays) ⇒ Object
6 7 8 9 10 11 12 13 14 15 |
# File 'lib/montrose/month_day.rb', line 6 def parse(mdays) return nil unless mdays.present? case mdays when String parse(mdays.split(",")) else Array(mdays).map { |d| assert(d.to_i) } end end |