TExpr that matches periods of the day with minute precision. If the start hour is greater than the end hour, than end hour is assumed to be on the following day.
NOTE: By default, this class will match any date expression whose precision is less than or equal to DPrecision::DAY. To override this behavior, pass the optional fifth constructor argument the value: false.
See also: Date
# File lib/runt/temporalexpression.rb, line 569 def initialize(start_hour, start_minute, end_hour, end_minute, less_precise_match=true) start_time = PDate.min(ANY_DATE.year,ANY_DATE.month, ANY_DATE.day,start_hour,start_minute) if(@spans_midnight = spans_midnight?(start_hour, end_hour)) then end_time = get_next(end_hour,end_minute) else end_time = get_current(end_hour,end_minute) end @range = start_time..end_time @less_precise_match = less_precise_match end
# File lib/runt/temporalexpression.rb, line 584 def include?(date) # # If @less_precise_match == true and the precision of the argument # is day or greater, then the result is always true return true if @less_precise_match && date.date_precision <= DPrecision::DAY if(@spans_midnight&&date.hour<12) then #Assume next day return @range.include?(get_next(date.hour,date.min)) end #Same day return @range.include?(get_current(date.hour,date.min)) end
Generated with the Darkfish Rdoc Generator 2.