summaryrefslogtreecommitdiff
path: root/lib/chef/version_string.rb
diff options
context:
space:
mode:
authorNoah Kantrowitz <noah@coderanger.net>2017-05-25 18:43:21 -0500
committerNoah Kantrowitz <noah@coderanger.net>2017-05-25 18:43:21 -0500
commit9cc61a93c3bff5c62a3d354e0d3216de01eb9f0b (patch)
tree147512e0f3ac13e8a9e3083bc722aad24666941c /lib/chef/version_string.rb
parentd9a4af931c0b17e2a1e3e3d7a9f682b7193a73c4 (diff)
downloadchef-9cc61a93c3bff5c62a3d354e0d3216de01eb9f0b.tar.gz
The case syntax is nice but not worth a core monkeypatch. ::sad trombone::
Signed-off-by: Noah Kantrowitz <noah@coderanger.net>
Diffstat (limited to 'lib/chef/version_string.rb')
-rw-r--r--lib/chef/version_string.rb29
1 files changed, 0 insertions, 29 deletions
diff --git a/lib/chef/version_string.rb b/lib/chef/version_string.rb
index 2777a635d7..7aed2da9b9 100644
--- a/lib/chef/version_string.rb
+++ b/lib/chef/version_string.rb
@@ -139,34 +139,5 @@ class Chef
end
end
- # Grouping operator to support fancy `case` blocks. Requires the String
- # monkeypatch below to function.
- #
- # @param other [Object]
- # @return [Boolean]
- # @example
- # case Chef::VersionString.new('1.0.0')
- # when '~> 2.0'
- # :two
- # when '~> 1.0'
- # :one
- # end
- def ===(other)
- self =~ other
- rescue ArgumentError
- super
- end
-
end
end
-
-# Monkeypatch string grouping to allow the nice case syntax shown above.
-String.prepend(Module.new do
- def ===(other)
- if other.is_a?(Chef::VersionString)
- other === self
- else
- super
- end
- end
-end)