lib/repeatable/expression/base.rb in repeatable-0.1.0 vs lib/repeatable/expression/base.rb in repeatable-0.2.0
- old
+ new
@@ -1,15 +1,27 @@
module Repeatable
module Expression
class Base
def self.===(other)
- other.ancestors.include?(self)
+ case other
+ when Class
+ other.ancestors.include?(self)
+ else
+ super
+ end
end
def include?(_date)
fail(
NotImplementedError,
- "Don't use Expression::Base directly. Subclasses should implement `#include?`"
+ "Don't use Expression::Base directly. Subclasses must implement `#include?`"
+ )
+ end
+
+ def to_h
+ fail(
+ NotImplementedError,
+ "Don't use Expression::Base directly. Subclasses must implement `#to_h`"
)
end
end
end
end