Sha256: 3af150756887b8754e48a85b478f0e01b9b8daeb889573f260fb012ba9ec5dec
Contents?: true
Size: 549 Bytes
Versions: 5
Compression:
Stored size: 549 Bytes
Contents
module Montrose class MonthDay class << self MDAYS = (-31.upto(-1).to_a + 1.upto(31).to_a) 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 def assert(number) test = number.abs raise ConfigurationError, "Out of range: #{MDAYS.inspect} does not include #{test}" unless MDAYS.include?(number.abs) number end end end end
Version data entries
5 entries across 5 versions & 1 rubygems