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
commit31b61cb01342b5a2079cb447693d003bdf455a65 (patch)
tree4247ee1ff223c611be61a7dcf224f74ce15666a0 /Library
parent2ff6c40735be2aca0e37ed94095526abcd115310 (diff)
downloadbrew-31b61cb01342b5a2079cb447693d003bdf455a65.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?