Class: Repeatable::Expression::Base Abstract

Inherits:
Object
  • Object
show all
Extended by:
T::Helpers, T::Sig
Defined in:
lib/repeatable/expression/base.rb

Overview

This class is abstract.

It cannot be directly instantiated. Subclasses must implement the ‘abstract` methods below.

Direct Known Subclasses

Date, Difference, Set

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.===(other) ⇒ Boolean

Parameters:

  • other (Object)

Returns:

  • (Boolean)


12
13
14
15
16
17
18
19
# File 'lib/repeatable/expression/base.rb', line 12

def self.===(other)
  case other
  when Class
    other.ancestors.include?(self)
  else
    super
  end
end

Instance Method Details

#deconstruct_keys(_keys) ⇒ Hash{Symbol => Types::SymbolHash, Array<Types::SymbolHash>}

Parameters:

  • _keys (Array<Symbol>, nil)

Returns:



31
32
33
# File 'lib/repeatable/expression/base.rb', line 31

def deconstruct_keys(_keys)
  to_h
end

#difference(other) ⇒ Expression::Difference Also known as: -

Parameters:

  • other (T.untyped)

Returns:



49
50
51
# File 'lib/repeatable/expression/base.rb', line 49

def difference(other)
  Difference.new(included: self, excluded: other)
end

#include?(date) ⇒ Boolean

This method is abstract.

Parameters:

  • date (::Date)

Returns:

  • (Boolean)


22
23
# File 'lib/repeatable/expression/base.rb', line 22

def include?(date)
end

#intersection(other) ⇒ Expression::Intersection Also known as: &

Parameters:

Returns:



43
44
45
# File 'lib/repeatable/expression/base.rb', line 43

def intersection(other)
  Intersection.new(self, other)
end

#to_hHash{Symbol => Types::SymbolHash, Array<Types::SymbolHash>}

Returns:



26
27
28
# File 'lib/repeatable/expression/base.rb', line 26

def to_h
  {hash_key => hash_value}
end

#union(other) ⇒ Expression::Union Also known as: +, |

Parameters:

Returns:



36
37
38
# File 'lib/repeatable/expression/base.rb', line 36

def union(other)
  Union.new(self, other)
end