aboutsummaryrefslogtreecommitdiffstats
path: root/Library
diff options
context:
space:
mode:
authorJack Nagel2012-07-10 22:08:06 -0500
committerJack Nagel2012-08-18 11:12:10 -0500
commit816348131bc85a27e64e78e992b2187f1a4bf8c5 (patch)
treec63927d8861061fac98972b3748f2fce0b85106b /Library
parentdb7a800130a0fdfb0fa325d73846a7af207286a2 (diff)
downloadhomebrew-816348131bc85a27e64e78e992b2187f1a4bf8c5.tar.bz2
keg: add method to return the corresponding Version
Diffstat (limited to 'Library')
-rw-r--r--Library/Homebrew/keg.rb9
1 files changed, 9 insertions, 0 deletions
diff --git a/Library/Homebrew/keg.rb b/Library/Homebrew/keg.rb
index dae91ea1d..d7ad80aee 100644
--- a/Library/Homebrew/keg.rb
+++ b/Library/Homebrew/keg.rb
@@ -67,6 +67,15 @@ class Keg < Pathname
dir.directory? and not dir.children.length.zero?
end
+ def version
+ require 'version'
+ Version.new(basename.to_s)
+ end
+
+ def basename
+ Pathname.new(self.to_s).basename
+ end
+
def link mode=nil
raise "Cannot link #{fname}\nAnother version is already linked: #{linked_keg_record.realpath}" if linked_keg_record.directory?