diff options
author | akr <akr@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2010-07-31 07:21:42 +0000 |
---|---|---|
committer | akr <akr@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2010-07-31 07:21:42 +0000 |
commit | 9006bd201535061bdf11192430432fee33bc9327 (patch) | |
tree | 7b51ee44813602466dfe14f49a169b37bf01f88c | |
parent | 0794c1da9325b51c627dab99ec2e7ff71a5bcdda (diff) | |
download | ruby-9006bd201535061bdf11192430432fee33bc9327.tar.gz |
* ext/pathname/pathname.c (Init_pathname): The alias,
Pathname#to_path, is translated from pathname.rb.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@28807 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
-rw-r--r-- | ChangeLog | 5 | ||||
-rw-r--r-- | ext/pathname/lib/pathname.rb | 3 | ||||
-rw-r--r-- | ext/pathname/pathname.c | 7 |
3 files changed, 12 insertions, 3 deletions
@@ -1,3 +1,8 @@ +Sat Jul 31 15:50:03 2010 Tanaka Akira <akr@fsij.org> + + * ext/pathname/pathname.c (Init_pathname): The alias, + Pathname#to_path, is translated from pathname.rb. + Sat Jul 31 09:12:36 2010 Tanaka Akira <akr@fsij.org> * ext/pathname/pathname.c (path_to_s): Pathname#to_s translated diff --git a/ext/pathname/lib/pathname.rb b/ext/pathname/lib/pathname.rb index 550939afd9..57e410f345 100644 --- a/ext/pathname/lib/pathname.rb +++ b/ext/pathname/lib/pathname.rb @@ -31,9 +31,6 @@ class Pathname # :startdoc: - # to_path is implemented so Pathname objects are usable with File.open, etc. - alias_method TO_PATH, :to_s - def inspect # :nodoc: "#<#{self.class}:#{@path}>" end diff --git a/ext/pathname/pathname.c b/ext/pathname/pathname.c index 20c7745863..02f964058e 100644 --- a/ext/pathname/pathname.c +++ b/ext/pathname/pathname.c @@ -127,7 +127,13 @@ path_hash(VALUE self) } /* + * call-seq: + * pathname.to_s => string + * pathname.to_path => string + * * Return the path as a String. + * + * to_path is implemented so Pathname objects are usable with File.open, etc. */ static VALUE path_to_s(VALUE self) @@ -329,4 +335,5 @@ Init_pathname() rb_define_method(rb_cPathname, "<=>", path_cmp, 1); rb_define_method(rb_cPathname, "hash", path_hash, 0); rb_define_method(rb_cPathname, "to_s", path_to_s, 0); + rb_define_method(rb_cPathname, "to_path", path_to_s, 0); } |