]> git.openstreetmap.org Git - chef.git/blobdiff - cookbooks/chef/libraries/compare_versions.rb
Respond with 429 to abusive "ping" requests
[chef.git] / cookbooks / chef / libraries / compare_versions.rb
index d2ccf8a0836e48470f0653ef195e9d23fdb67fc1..45653935f08ca480e3f00cc1ddfe2fd8b2cf27d9 100644 (file)
@@ -1,13 +1,9 @@
 class Chef
   class Util
     def self.compare_versions(a, b)
-      if a.kind_of?(String)
-        a = a.split(".").map { |c| c.to_i }
-      end
+      a = a.split(".").map(&:to_i) if a.is_a?(String)
 
-      if b.kind_of?(String)
-        b = b.split(".").map { |c| c.to_i }
-      end
+      b = b.split(".").map(&:to_i) if b.is_a?(String)
 
       a <=> b
     end