Class: Makit::Version
- Inherits:
-
Object
- Object
- Makit::Version
- Defined in:
- lib/makit/version_util.rb
Overview
Version utility class for handling version comparisons
Class Method Summary collapse
-
.get_highest_version(versions) ⇒ String?
Get the highest version from a list of version strings.
Class Method Details
.get_highest_version(versions) ⇒ String?
Get the highest version from a list of version strings
10 11 12 13 14 15 16 17 18 19 |
# File 'lib/makit/version_util.rb', line 10 def self.get_highest_version(versions) return nil if versions.nil? || versions.empty? # Sort versions using Gem::Version for proper semantic versioning sorted_versions = versions.sort_by { |v| Gem::Version.new(v) } sorted_versions.last rescue ArgumentError # If any version is invalid, fall back to string sorting versions.max end |