aboutsummaryrefslogtreecommitdiffstats
path: root/Library/Homebrew/version.rb
diff options
context:
space:
mode:
authorJack Nagel2013-10-25 17:29:36 -0500
committerJack Nagel2013-10-25 17:29:45 -0500
commit08d52978c2ca2e4ecf1dce2ac2c9a6547c6bc7f8 (patch)
tree77f87525f2dc2ad44d69c85a84c778590977a026 /Library/Homebrew/version.rb
parent4e6f20272a514d594044790fda7d759d7bac07a2 (diff)
downloadhomebrew-08d52978c2ca2e4ecf1dce2ac2c9a6547c6bc7f8.tar.bz2
Disallow initializing Versions with non-strings
Closes #23553.
Diffstat (limited to 'Library/Homebrew/version.rb')
-rw-r--r--Library/Homebrew/version.rb7
1 files changed, 6 insertions, 1 deletions
diff --git a/Library/Homebrew/version.rb b/Library/Homebrew/version.rb
index 6c91bec4a..4c268639d 100644
--- a/Library/Homebrew/version.rb
+++ b/Library/Homebrew/version.rb
@@ -163,7 +163,12 @@ class Version
end
def initialize(val, detected=false)
- @version = val.to_s
+ if val.respond_to?(:to_str)
+ @version = val.to_str
+ else
+ raise TypeError, "Version value must be a string"
+ end
+
@detected_from_url = detected
end