keg: add method to return the corresponding Version
This commit is contained in:
parent
2ff6c40735
commit
31b61cb013
@ -67,6 +67,15 @@ class Keg < Pathname
|
|||||||
dir.directory? and not dir.children.length.zero?
|
dir.directory? and not dir.children.length.zero?
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def version
|
||||||
|
require 'version'
|
||||||
|
Version.new(basename.to_s)
|
||||||
|
end
|
||||||
|
|
||||||
|
def basename
|
||||||
|
Pathname.new(self.to_s).basename
|
||||||
|
end
|
||||||
|
|
||||||
def link mode=nil
|
def link mode=nil
|
||||||
raise "Cannot link #{fname}\nAnother version is already linked: #{linked_keg_record.realpath}" if linked_keg_record.directory?
|
raise "Cannot link #{fname}\nAnother version is already linked: #{linked_keg_record.realpath}" if linked_keg_record.directory?
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user