Class: Runt::WIMonth
Overview
TExpr that matches the week in a month. For example:
WIMonth.new(1)
See also: Date
Constant Summary collapse
- VALID_RANGE =
-2..5
Instance Method Summary collapse
- #include?(date) ⇒ Boolean
-
#initialize(ordinal) ⇒ WIMonth
constructor
A new instance of WIMonth.
Methods inherited from TExpr
#&, #-, #and, #minus, #or, #to_s, #|
Constructor Details
#initialize(ordinal) ⇒ WIMonth
Returns a new instance of WIMonth.
454 455 456 457 458 459 |
# File 'lib/runt/temporalexpression.rb', line 454 def initialize(ordinal) unless VALID_RANGE.include?(ordinal) raise ArgumentError, 'invalid ordinal week of month' end @ordinal = ordinal end |
Instance Method Details
#include?(date) ⇒ Boolean
461 462 463 |
# File 'lib/runt/temporalexpression.rb', line 461 def include?(date) week_matches?(@ordinal,date) end |