lib/doing/changelog/version.rb in doing-2.1.29 vs lib/doing/changelog/version.rb in doing-2.1.30
- old
+ new
@@ -35,20 +35,24 @@
def wild?(val)
val.is_a?(String)
end
- def compare(other, comp)
+ def compare(other, comp, inclusive: false)
case comp
when :older
if @maj <= other.maj
if @maj < other.maj
true
elsif @maj == other.maj && (other.min.nil? || @min < other.min)
true
elsif @maj == other.maj && @min == other.min
- other.patch.nil? ? false : @patch < other.patch
+ if other.patch.nil?
+ false
+ else
+ inclusive ? @patch <= other.patch : @patch < other.patch
+ end
else
false
end
else
false
@@ -58,10 +62,14 @@
if @maj > other.maj
true
elsif @maj == other.maj && (other.min.nil? || @min > other.min)
true
elsif @maj == other.maj && @min == other.min
- other.patch.nil? || @patch >= other.patch
+ if other.patch.nil?
+ false
+ else
+ inclusive ? @patch >= other.patch : @patch > other.patch
+ end
else
false
end
else
false