class Repeatable::Expression::Base

Public Class Methods

===(other) click to toggle source
Calls superclass method
# File lib/repeatable/expression/base.rb, line 4
def self.===(other)
  case other
  when Class
    other.ancestors.include?(self)
  else
    super
  end
end

Public Instance Methods

&(other)
Alias for: intersection
+(other)
Alias for: union
-(other)
Alias for: difference
difference(other) click to toggle source
# File lib/repeatable/expression/base.rb, line 38
def difference(other)
  Difference.new(included: self, excluded: other)
end
Also aliased as: -
include?(_date) click to toggle source
# File lib/repeatable/expression/base.rb, line 13
def include?(_date)
  fail(
    NotImplementedError,
    "Don't use Expression::Base directly. Subclasses must implement `#include?`"
  )
end
intersection(other) click to toggle source
# File lib/repeatable/expression/base.rb, line 33
def intersection(other)
  Intersection.new(self, other)
end
Also aliased as: &
to_h() click to toggle source
# File lib/repeatable/expression/base.rb, line 20
def to_h
  fail(
    NotImplementedError,
    "Don't use Expression::Base directly. Subclasses must implement `#to_h`"
  )
end
union(other) click to toggle source
# File lib/repeatable/expression/base.rb, line 27
def union(other)
  Union.new(self, other)
end
Also aliased as: +, |
|(other)
Alias for: union

Private Instance Methods

hash_key() click to toggle source
# File lib/repeatable/expression/base.rb, line 45
def hash_key
  self.class.name.split("::").last
    .gsub(/(?<!\b)[A-Z]/) { "_#{Regexp.last_match[0]}" }
    .downcase
    .to_sym
end