Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'lib/gitlab/version_info.rb')
-rw-r--r--lib/gitlab/version_info.rb6
1 files changed, 5 insertions, 1 deletions
diff --git a/lib/gitlab/version_info.rb b/lib/gitlab/version_info.rb
index f967a12b959..61de003c28d 100644
--- a/lib/gitlab/version_info.rb
+++ b/lib/gitlab/version_info.rb
@@ -9,7 +9,7 @@ module Gitlab
VERSION_REGEX = /(\d+)\.(\d+)\.(\d+)/.freeze
def self.parse(str, parse_suffix: false)
- if str.is_a?(self.class)
+ if str.is_a?(self)
str
elsif str && m = str.match(VERSION_REGEX)
VersionInfo.new(m[1].to_i, m[2].to_i, m[3].to_i, parse_suffix ? m.post_match : nil)
@@ -62,6 +62,10 @@ module Gitlab
end
end
+ def to_json(*_args)
+ { major: @major, minor: @minor, patch: @patch }.to_json
+ end
+
def suffix
@suffix ||= @suffix_s.strip.gsub('-', '.pre.').scan(/\d+|[a-z]+/i).map do |s|
/^\d+$/ =~ s ? s.to_i : s