Method: NOTAM::Schedule.parse
- Defined in:
- lib/notam/schedule.rb
.parse(string, base_date:) ⇒ Array<NOTAM::Schedule>
Parse the schedule part of a D item.
66 67 68 69 70 71 72 73 74 75 76 77 78 79 |
# File 'lib/notam/schedule.rb', line 66 def parse(string, base_date:) @rules, @exceptions = cleanup(string).split(/ EXC /).map(&:strip) @base_date = base_date.at(day: 1) case @rules when /^#{DATETIME_RANGE_RE}$/ parse_datetimes when /^(#{DAY_RE}|#{TIME_RANGE_RE})/ parse_days when /^(#{DATE_RE}|#{MONTH_RE})/ parse_dates else fail! "unrecognized schedule" end end |