Files
wpscan/lib/common/version_compare.rb
Christian Mehlmauer 3e9c51f18e some more work for #179
2013-05-06 23:36:18 +02:00

16 lines
402 B
Ruby

# encoding: UTF-8
class VersionCompare
# Compares two version strings. Returns true if version1 is equal to version2
# or when version1 is older than version2
#
# @param [ String ] version1
# @param [ String ] version2
#
# @return [ Boolean ]
def self.is_newer_or_same?(version1, version2)
(version1 == version2) || (Gem::Version.new(version1) < Gem::Version.new(version2))
end
end