* lib/pathname.rb (Pathname#sub): new method.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@9287 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
akr 2005-09-23 23:32:29 +00:00
parent a33aa9c9f4
commit 9bfb4dc6ac
2 changed files with 13 additions and 1 deletions

View File

@ -1,3 +1,7 @@
Sat Sep 24 08:30:00 2005 Tanaka Akira <akr@m17n.org>
* lib/pathname.rb (Pathname#sub): new method.
Sat Sep 24 08:29:36 2005 Minero Aoki <aamine@loveruby.net> Sat Sep 24 08:29:36 2005 Minero Aoki <aamine@loveruby.net>
* lib/fileutils.rb: fix visibility of FileUtils::NoWrite, Verbose, * lib/fileutils.rb: fix visibility of FileUtils::NoWrite, Verbose,

View File

@ -235,7 +235,11 @@ class Pathname
"#<#{self.class}:#{@path}>" "#<#{self.class}:#{@path}>"
end end
# # Return a pathname which is substituted by String#sub.
def sub(pattern, *rest, &block)
Pathname.new(@path.sub(pattern, *rest, &block))
end
# Returns clean pathname of +self+ with consecutive slashes and useless dots # Returns clean pathname of +self+ with consecutive slashes and useless dots
# removed. The filesystem is not accessed. # removed. The filesystem is not accessed.
# #
@ -438,6 +442,8 @@ class Pathname
# #<Pathname:path/to/some> # #<Pathname:path/to/some>
# #<Pathname:path/to/some/file.rb> # #<Pathname:path/to/some/file.rb>
# #
# It doesn't access actual filesystem.
#
def descend def descend
paths = [] paths = []
v = self v = self
@ -473,6 +479,8 @@ class Pathname
# #<Pathname:path/to> # #<Pathname:path/to>
# #<Pathname:path> # #<Pathname:path>
# #
# It doesn't access actual filesystem.
#
def ascend def ascend
paths = [] paths = []
v = self v = self