]> git.openstreetmap.org Git - chef.git/blob - cookbooks/chef/libraries/compare_versions.rb
Fix some issues identified by rubocop
[chef.git] / cookbooks / chef / libraries / compare_versions.rb
1 class Chef
2   class Util
3     def self.compare_versions(a, b)
4       if a.kind_of?(String)
5         a = a.split(".").map { |c| c.to_i }
6       end
7
8       if b.kind_of?(String)
9         b = b.split(".").map { |c| c.to_i }
10       end
11
12       a <=> b
13     end
14   end
15 end