diff options
| author | Jack Nagel | 2013-10-25 17:29:36 -0500 | 
|---|---|---|
| committer | Jack Nagel | 2013-10-25 17:29:45 -0500 | 
| commit | 08d52978c2ca2e4ecf1dce2ac2c9a6547c6bc7f8 (patch) | |
| tree | 77f87525f2dc2ad44d69c85a84c778590977a026 /Library/Homebrew/version.rb | |
| parent | 4e6f20272a514d594044790fda7d759d7bac07a2 (diff) | |
| download | homebrew-08d52978c2ca2e4ecf1dce2ac2c9a6547c6bc7f8.tar.bz2 | |
Disallow initializing Versions with non-strings
Closes #23553.
Diffstat (limited to 'Library/Homebrew/version.rb')
| -rw-r--r-- | Library/Homebrew/version.rb | 7 | 
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  | 
