summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--ChangeLog5
-rw-r--r--ext/pathname/lib/pathname.rb5
-rw-r--r--ext/pathname/pathname.c10
3 files changed, 15 insertions, 5 deletions
diff --git a/ChangeLog b/ChangeLog
index 04dc4f6cf1..4e0a58a886 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,8 @@
+Sat Jul 31 09:12:36 2010 Tanaka Akira <akr@fsij.org>
+
+ * ext/pathname/pathname.c (path_to_s): Pathname#to_s translated
+ from pathname.rb.
+
Sat Jul 31 08:20:07 2010 NAKAMURA, Hiroshi <nahi@ruby-lang.org>
* lib/webrick/ssl.rb (WEBrick::Utils.create_self_signed_cert):
diff --git a/ext/pathname/lib/pathname.rb b/ext/pathname/lib/pathname.rb
index 75705ff993..550939afd9 100644
--- a/ext/pathname/lib/pathname.rb
+++ b/ext/pathname/lib/pathname.rb
@@ -31,11 +31,6 @@ class Pathname
# :startdoc:
- # Return the path as a String.
- def to_s
- @path.dup
- end
-
# to_path is implemented so Pathname objects are usable with File.open, etc.
alias_method TO_PATH, :to_s
diff --git a/ext/pathname/pathname.c b/ext/pathname/pathname.c
index f437d7f859..20c7745863 100644
--- a/ext/pathname/pathname.c
+++ b/ext/pathname/pathname.c
@@ -127,6 +127,15 @@ path_hash(VALUE self)
}
/*
+ * Return the path as a String.
+ */
+static VALUE
+path_to_s(VALUE self)
+{
+ return rb_obj_dup(get_strpath(self));
+}
+
+/*
* == Pathname
*
* Pathname represents a pathname which locates a file in a filesystem.
@@ -319,4 +328,5 @@ Init_pathname()
rb_define_method(rb_cPathname, "eql?", path_eq, 1);
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);
}