Class: Repeatable::Expression::Difference
- Inherits:
-
Base
- Object
- Base
- Repeatable::Expression::Difference
show all
- Defined in:
- lib/repeatable/expression/difference.rb
Instance Method Summary
collapse
Methods inherited from Base
===, #difference, #intersection, #union
Constructor Details
#initialize(included:, excluded:) ⇒ Difference
Returns a new instance of Difference.
4
5
6
7
|
# File 'lib/repeatable/expression/difference.rb', line 4
def initialize(included:, excluded:)
@included = included
@excluded = excluded
end
|
Instance Method Details
#==(other) ⇒ Object
17
18
19
20
21
|
# File 'lib/repeatable/expression/difference.rb', line 17
def ==(other)
other.is_a?(self.class) &&
included == other.included &&
excluded == other.excluded
end
|
#include?(date) ⇒ Boolean
9
10
11
|
# File 'lib/repeatable/expression/difference.rb', line 9
def include?(date)
included.include?(date) && !excluded.include?(date)
end
|
#to_h ⇒ Object
13
14
15
|
# File 'lib/repeatable/expression/difference.rb', line 13
def to_h
Hash[hash_key, { included: included.to_h, excluded: excluded.to_h }]
end
|