summaryrefslogtreecommitdiffstats
path: root/lib
diff options
context:
space:
mode:
authorakr <akr@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2005-09-23 23:32:29 +0000
committerakr <akr@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2005-09-23 23:32:29 +0000
commit378a917894b7b14d5c8a72f3a8eb7f2cff96b930 (patch)
tree02dfc38af0641dcb36364db9c36a42e839bbc98e /lib
parent3963da86f3ead5fc2d0a5ac704f64b8a01ada3e9 (diff)
downloadruby-378a917894b7b14d5c8a72f3a8eb7f2cff96b930.tar.gz
ruby-378a917894b7b14d5c8a72f3a8eb7f2cff96b930.tar.xz
ruby-378a917894b7b14d5c8a72f3a8eb7f2cff96b930.zip
* lib/pathname.rb (Pathname#sub): new method.
git-svn-id: http://svn.ruby-lang.org/repos/ruby/trunk@9287 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'lib')
-rw-r--r--lib/pathname.rb10
1 files changed, 9 insertions, 1 deletions
diff --git a/lib/pathname.rb b/lib/pathname.rb
index 7b371def2..e4e2b0199 100644
--- a/lib/pathname.rb
+++ b/lib/pathname.rb
@@ -235,7 +235,11 @@ class Pathname
"#<#{self.class}:#{@path}>"
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
# removed. The filesystem is not accessed.
#
@@ -438,6 +442,8 @@ class Pathname
# #<Pathname:path/to/some>
# #<Pathname:path/to/some/file.rb>
#
+ # It doesn't access actual filesystem.
+ #
def descend
paths = []
v = self
@@ -473,6 +479,8 @@ class Pathname
# #<Pathname:path/to>
# #<Pathname:path>
#
+ # It doesn't access actual filesystem.
+ #
def ascend
paths = []
v = self