Class: Runt::REWeek
Overview
TExpr that matches days of the week within one week only.
If start and end day are equal, the entire week will match true.
See also: Date
Constant Summary collapse
- VALID_RANGE =
0..6
Instance Method Summary collapse
- #include?(date) ⇒ Boolean
-
#initialize(start_day, end_day = 6) ⇒ REWeek
constructor
ArgumentError will be raised.
- #to_s ⇒ Object
Methods inherited from TExpr
Constructor Details
#initialize(start_day, end_day = 6) ⇒ REWeek
ArgumentError will be raised
312 313 314 315 316 317 |
# File 'lib/runt/temporalexpression.rb', line 312 def initialize(start_day,end_day=6) super() validate(start_day,end_day) @start_day = start_day @end_day = end_day end |
Instance Method Details
#include?(date) ⇒ Boolean
319 320 321 322 |
# File 'lib/runt/temporalexpression.rb', line 319 def include?(date) return true if @start_day==@end_day @start_day<=date.wday && @end_day>=date.wday end |
#to_s ⇒ Object
324 325 326 |
# File 'lib/runt/temporalexpression.rb', line 324 def to_s "REWeek" end |