lib/aixm/schedule/time.rb in aixm-1.3.0 vs lib/aixm/schedule/time.rb in aixm-1.3.1

- old
+ new

@@ -17,10 +17,14 @@ # therefore {DATELESS_DATE} + 1 marks this case. # # @example # time = AIXM.time('21:30') # => 21:30 # time.covered_by?(AIXM.time('20:00')..AIXM.time('02:00')) # => true + # + # ===Shortcuts: + # * +AIXM::BEGINNING_OF_DAY+ - midnight expressed as "00:00" + # * +AIXM::END_OF_DAY+ - midnight expressed as "24:00" class Time include AIXM::Concerns::HashEquality extend Forwardable EVENTS = { sunrise: :up, sunset: :down }.freeze @@ -71,10 +75,10 @@ alternative_event = binding.local_variable_get(:or) # necessary since "or" is a keyword @time = @event = @precedence = nil case time_or_event when Symbol self.event = time_or_event - when ::Time, DateTime + when ::Time, ::DateTime time_or_event = time_or_event.to_time set_time(time_or_event.hour, time_or_event.min, time_or_event.utc_offset) when /\A(\d{2}):?(\d{2}) ?([+-]\d{2}:?\d{2}|UTC)?\z/ set_time($1, $2, $3) else