summaryrefslogtreecommitdiff
path: root/ext/pathname
diff options
context:
space:
mode:
Diffstat (limited to 'ext/pathname')
-rw-r--r--ext/pathname/lib/pathname.rb10
-rw-r--r--ext/pathname/pathname.c12
2 files changed, 12 insertions, 10 deletions
diff --git a/ext/pathname/lib/pathname.rb b/ext/pathname/lib/pathname.rb
index f6e06f2092..224c869f67 100644
--- a/ext/pathname/lib/pathname.rb
+++ b/ext/pathname/lib/pathname.rb
@@ -525,13 +525,3 @@ class Pathname # * FileUtils *
end
end
-
-module Kernel
- # create a pathname object.
- #
- # This method is available since 1.8.5.
- def Pathname(path) # :doc:
- Pathname.new(path)
- end
- private :Pathname
-end
diff --git a/ext/pathname/pathname.c b/ext/pathname/pathname.c
index b3fe3af9ca..74efc996dc 100644
--- a/ext/pathname/pathname.c
+++ b/ext/pathname/pathname.c
@@ -962,6 +962,17 @@ path_unlink(VALUE self)
}
/*
+ * create a pathname object.
+ *
+ * This method is available since 1.8.5.
+ */
+static VALUE
+path_f_pathname(VALUE self, VALUE str)
+{
+ return rb_class_new_instance(1, &str, rb_cPathname);
+}
+
+/*
* == Pathname
*
* Pathname represents a pathname which locates a file in a filesystem.
@@ -1225,4 +1236,5 @@ Init_pathname()
rb_define_method(rb_cPathname, "unlink", path_unlink, 0);
rb_define_method(rb_cPathname, "delete", path_unlink, 0);
rb_undef_method(rb_cPathname, "=~");
+ rb_define_global_function("Pathname", path_f_pathname, 1);
}