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