Sha256: ae8f6919770cc9565508be4f9b457f9dd1f2bd7cad31968612276d05a427ac78
Contents?: true
Size: 541 Bytes
Versions: 19
Compression:
Stored size: 541 Bytes
Contents
# A function that sorts an array of version numbers. Puppet::Functions.create_function(:'extlib::sort_by_version') do # @param versions An array of version strings you want sorted. # @return Returns the sorted array. # @example Calling the function # extlib::sort_by_version(['10.0.0b12', '10.0.0b3', '10.0.0a2', '9.0.10', '9.0.3']) dispatch :sort_by_version do param 'Array[String]', :versions return_type 'Array[String]' end def sort_by_version(versions) versions.sort_by { |v| Gem::Version.new(v) } end end
Version data entries
19 entries across 19 versions & 1 rubygems