lib/versionaire/version.rb in versionaire-10.6.0 vs lib/versionaire/version.rb in versionaire-11.0.0
- old
+ new
@@ -7,25 +7,10 @@
Version = Struct.new :major, :minor, :patch, keyword_init: true do
include Comparable
using Refinements::Structs
- def self.delimiter = "."
-
- def self.pattern
- /
- \A( # Start of string and OR.
- \d* # Major only.
- | # OR pipe.
- \d+ # Major.
- #{delimiter}? # Delimiter.
- \d* # Minor.
- (?:#{delimiter}\d+) # Passive delimiter and patch.
- )\z # End of OR and string.
- /x
- end
-
def initialize major: 0, minor: 0, patch: 0
super
validate
freeze
end
@@ -50,10 +35,10 @@
def inspect = to_s.inspect
def to_proc = method(:[]).to_proc
- def to_s = to_a.join(self.class.delimiter)
+ def to_s = to_a.join DELIMITER
alias_method :to_str, :to_s
private