Move Pathname.starts_with? into Pathname

This commit is contained in:
Adam Vandenberg 2010-08-08 09:13:27 -07:00
parent eca31da253
commit 013fe4bf38
2 changed files with 6 additions and 8 deletions

View File

@ -3,19 +3,12 @@ require 'extend/pathname'
REAL_CELLAR = HOMEBREW_CELLAR.realpath
class String
def starts_with?(prefix)
def starts_with? prefix
prefix = prefix.to_s
self[0, prefix.length] == prefix
end
end
class Pathname
def starts_with?(prefix)
prefix = prefix.to_s
self.to_s[0, prefix.length] == prefix
end
end
def audit
brew_links = Array.new

View File

@ -203,6 +203,11 @@ class Pathname
def resolved_path_exists?
(dirname+readlink).exist?
end
def starts_with? prefix
prefix = prefix.to_s
self.to_s[0, prefix.length] == prefix
end
end
# sets $n and $d so you can observe creation of stuff