Class: Boundy::Domain::Comparator
- Inherits:
-
Object
- Object
- Boundy::Domain::Comparator
- Includes:
- Comparator
- Defined in:
- lib/boundy/domain/comparator.rb
Instance Method Summary collapse
- #after? ⇒ Boolean
- #before? ⇒ Boolean
-
#initialize(datum, subject) ⇒ Comparator
constructor
A new instance of Comparator.
- #within? ⇒ Boolean
Methods included from Comparator
Constructor Details
#initialize(datum, subject) ⇒ Comparator
Returns a new instance of Comparator.
8 9 10 11 |
# File 'lib/boundy/domain/comparator.rb', line 8 def initialize(datum, subject) @datum = datum @subject = subject end |
Instance Method Details
#after? ⇒ Boolean
13 14 15 |
# File 'lib/boundy/domain/comparator.rb', line 13 def after? @subject.from > @datum && @subject.to >= @datum end |
#before? ⇒ Boolean
17 18 19 |
# File 'lib/boundy/domain/comparator.rb', line 17 def before? @subject.from <= @datum && @subject.to < @datum end |
#within? ⇒ Boolean
21 22 23 |
# File 'lib/boundy/domain/comparator.rb', line 21 def within? @subject.from <= @datum && @subject.to >= @datum end |