Move Pathname.starts_with? into Pathname
This commit is contained in:
parent
eca31da253
commit
013fe4bf38
@ -3,19 +3,12 @@ require 'extend/pathname'
|
|||||||
REAL_CELLAR = HOMEBREW_CELLAR.realpath
|
REAL_CELLAR = HOMEBREW_CELLAR.realpath
|
||||||
|
|
||||||
class String
|
class String
|
||||||
def starts_with?(prefix)
|
def starts_with? prefix
|
||||||
prefix = prefix.to_s
|
prefix = prefix.to_s
|
||||||
self[0, prefix.length] == prefix
|
self[0, prefix.length] == prefix
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
class Pathname
|
|
||||||
def starts_with?(prefix)
|
|
||||||
prefix = prefix.to_s
|
|
||||||
self.to_s[0, prefix.length] == prefix
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
|
|
||||||
def audit
|
def audit
|
||||||
brew_links = Array.new
|
brew_links = Array.new
|
||||||
|
|||||||
@ -203,6 +203,11 @@ class Pathname
|
|||||||
def resolved_path_exists?
|
def resolved_path_exists?
|
||||||
(dirname+readlink).exist?
|
(dirname+readlink).exist?
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def starts_with? prefix
|
||||||
|
prefix = prefix.to_s
|
||||||
|
self.to_s[0, prefix.length] == prefix
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
# sets $n and $d so you can observe creation of stuff
|
# sets $n and $d so you can observe creation of stuff
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user