diff options
| author | Adam Vandenberg | 2010-08-08 09:13:27 -0700 |
|---|---|---|
| committer | Adam Vandenberg | 2010-08-08 09:13:27 -0700 |
| commit | e719d94b486d5406db2b5d70efa2c0c30f0a4409 (patch) | |
| tree | 3010963ed8dca275032277ab0b0d6df2e2bf38ba /Library | |
| parent | 4d3098728d61128ff32e0d4a686a4f3a7de7954f (diff) | |
| download | homebrew-e719d94b486d5406db2b5d70efa2c0c30f0a4409.tar.bz2 | |
Move Pathname.starts_with? into Pathname
Diffstat (limited to 'Library')
| -rwxr-xr-x | Library/Contributions/examples/brew-which.rb | 9 | ||||
| -rw-r--r-- | Library/Homebrew/extend/pathname.rb | 5 |
2 files changed, 6 insertions, 8 deletions
diff --git a/Library/Contributions/examples/brew-which.rb b/Library/Contributions/examples/brew-which.rb index a331e9f45..9e5eb64fb 100755 --- a/Library/Contributions/examples/brew-which.rb +++ b/Library/Contributions/examples/brew-which.rb @@ -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 diff --git a/Library/Homebrew/extend/pathname.rb b/Library/Homebrew/extend/pathname.rb index 93a1f08cc..cb06688d7 100644 --- a/Library/Homebrew/extend/pathname.rb +++ b/Library/Homebrew/extend/pathname.rb @@ -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 |
