diff options
| author | Max Howell | 2010-02-27 12:29:45 +0000 |
|---|---|---|
| committer | Max Howell | 2010-02-27 12:29:45 +0000 |
| commit | 4e772f2a3491bea121bffd53914bc0805d5ed7e1 (patch) | |
| tree | d4a9ccdaf9deeed87a39424308c0c4113f1f8b9a /Library | |
| parent | 3ea3d729d0dbba7a1e7ca98e5fdd0a5265d93384 (diff) | |
| download | homebrew-4e772f2a3491bea121bffd53914bc0805d5ed7e1.tar.bz2 | |
Pathname.subdirs and Pathname.cd{}
Diffstat (limited to 'Library')
| -rw-r--r-- | Library/Homebrew/extend/pathname.rb | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/Library/Homebrew/extend/pathname.rb b/Library/Homebrew/extend/pathname.rb index 698136fcb..0cff35c8a 100644 --- a/Library/Homebrew/extend/pathname.rb +++ b/Library/Homebrew/extend/pathname.rb @@ -167,6 +167,14 @@ class Pathname if '1.9' <= RUBY_VERSION alias_method :to_str, :to_s end + + def cd + Dir.chdir(self){ yield } + end + + def subdirs + children.select{ |child| child.directory? } + end end # sets $n and $d so you can observe creation of stuff |
