Class: Montrose::Hour
- Inherits:
-
Object
- Object
- Montrose::Hour
- Defined in:
- lib/montrose/hour.rb
Constant Summary collapse
- HOURS_IN_DAY =
1.upto(24).to_a.freeze
Class Method Summary collapse
Class Method Details
.assert(hour) ⇒ Object
15 16 17 18 19 |
# File 'lib/montrose/hour.rb', line 15 def assert(hour) raise ConfigurationError, "Out of range: #{HOURS_IN_DAY.inspect} does not include #{hour}" unless HOURS_IN_DAY.include?(hour) hour end |
.parse(arg) ⇒ Object
6 7 8 9 10 11 12 13 |
# File 'lib/montrose/hour.rb', line 6 def parse(arg) case arg when String parse(arg.split(",")) else Array(arg).map { |h| assert(h.to_i) }.presence end end |