Class: Montrose::Week
- Inherits:
-
Object
- Object
- Montrose::Week
- Defined in:
- lib/montrose/week.rb
Constant Summary collapse
- NUMBERS =
(-53.upto(-1).to_a + 1.upto(53).to_a)
Class Method Summary collapse
Class Method Details
.assert(number) ⇒ Object
12 13 14 15 16 17 |
# File 'lib/montrose/week.rb', line 12 def assert(number) test = number.abs raise ConfigurationError, "Out of range: #{NUMBERS.inspect} does not include #{test}" unless NUMBERS.include?(number.abs) number end |
.parse(arg) ⇒ Object
6 7 8 9 10 |
# File 'lib/montrose/week.rb', line 6 def parse(arg) return nil unless arg.present? Array(arg).map { |value| assert(value.to_i) } end |