Move initializer after constants and class methods
This commit is contained in:
parent
685bf070d1
commit
e21a1fab51
@ -4,12 +4,6 @@ require "formula_lock"
|
|||||||
require "ostruct"
|
require "ostruct"
|
||||||
|
|
||||||
class Keg < Pathname
|
class Keg < Pathname
|
||||||
def initialize path
|
|
||||||
super path
|
|
||||||
raise "#{to_s} is not a valid keg" unless parent.parent.realpath == HOMEBREW_CELLAR.realpath
|
|
||||||
raise "#{to_s} is not a directory" unless directory?
|
|
||||||
end
|
|
||||||
|
|
||||||
# locale-specific directories have the form language[_territory][.codeset][@modifier]
|
# locale-specific directories have the form language[_territory][.codeset][@modifier]
|
||||||
LOCALEDIR_RX = /(locale|man)\/([a-z]{2}|C|POSIX)(_[A-Z]{2})?(\.[a-zA-Z\-0-9]+(@.+)?)?/
|
LOCALEDIR_RX = /(locale|man)\/([a-z]{2}|C|POSIX)(_[A-Z]{2})?(\.[a-zA-Z\-0-9]+(@.+)?)?/
|
||||||
INFOFILE_RX = %r[info/([^.].*?\.info|dir)$]
|
INFOFILE_RX = %r[info/([^.].*?\.info|dir)$]
|
||||||
@ -40,6 +34,12 @@ class Keg < Pathname
|
|||||||
raise NotAKegError, "#{path} is not inside a keg"
|
raise NotAKegError, "#{path} is not inside a keg"
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def initialize path
|
||||||
|
super path
|
||||||
|
raise "#{to_s} is not a valid keg" unless parent.parent.realpath == HOMEBREW_CELLAR.realpath
|
||||||
|
raise "#{to_s} is not a directory" unless directory?
|
||||||
|
end
|
||||||
|
|
||||||
def uninstall
|
def uninstall
|
||||||
rmtree
|
rmtree
|
||||||
parent.rmdir_if_possible
|
parent.rmdir_if_possible
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user