Pathname.subdirs and Pathname.cd{}
This commit is contained in:
parent
c2f1a41bbc
commit
991bae91a9
@ -167,6 +167,14 @@ class Pathname
|
|||||||
if '1.9' <= RUBY_VERSION
|
if '1.9' <= RUBY_VERSION
|
||||||
alias_method :to_str, :to_s
|
alias_method :to_str, :to_s
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def cd
|
||||||
|
Dir.chdir(self){ yield }
|
||||||
|
end
|
||||||
|
|
||||||
|
def subdirs
|
||||||
|
children.select{ |child| child.directory? }
|
||||||
|
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