summaryrefslogtreecommitdiff
path: root/file.c
diff options
context:
space:
mode:
authorSamuel Williams <samuel.williams@oriontransfer.co.nz>2022-12-08 18:19:53 +1300
committerGitHub <noreply@github.com>2022-12-08 18:19:53 +1300
commit6fd5d2dc003bda5ce0685abd2b975d7ac7079d46 (patch)
treea7cffd3b1b2f40b76511d785b5c00f3d35245ee6 /file.c
parentb2764752b2bccb8e4574891d380d0f0a3d67add0 (diff)
downloadruby-6fd5d2dc003bda5ce0685abd2b975d7ac7079d46.tar.gz
Introduce `IO.new(..., path:)` and promote `File#path` to `IO#path`. (#6867)
Diffstat (limited to 'file.c')
-rw-r--r--file.c37
1 files changed, 0 insertions, 37 deletions
diff --git a/file.c b/file.c
index 5b17093ca3..705bb5ce62 100644
--- a/file.c
+++ b/file.c
@@ -484,41 +484,6 @@ apply2files(int (*func)(const char *, void *), int argc, VALUE *argv, void *arg)
return LONG2FIX(argc);
}
-/*
- * call-seq:
- * path -> filepath
- *
- * Returns the string filepath used to create +self+:
- *
- * f = File.new('t.txt') # => #<File:t.txt>
- f.path # => "t.txt"
- *
- * Does not normalize the returned filepath:
- *
- * f = File.new('../files/t.txt') # => #<File:../files/t.txt>
- f.path # => "../files/t.txt"
- *
- * Raises IOError for a file created using File::Constants::TMPFILE, because it has no filename.
- *
- * File#to_path is an alias for File#path.
- *
- */
-
-static VALUE
-rb_file_path(VALUE obj)
-{
- rb_io_t *fptr;
-
- fptr = RFILE(rb_io_taint_check(obj))->fptr;
- rb_io_check_initialized(fptr);
-
- if (NIL_P(fptr->pathv)) {
- rb_raise(rb_eIOError, "File is unnamed (TMPFILE?)");
- }
-
- return rb_str_dup(fptr->pathv);
-}
-
static size_t
stat_memsize(const void *p)
{
@@ -7555,8 +7520,6 @@ Init_File(void)
/* Name of the null device */
rb_define_const(rb_mFConst, "NULL", rb_fstring_cstr(ruby_null_device));
- rb_define_method(rb_cFile, "path", rb_file_path, 0);
- rb_define_method(rb_cFile, "to_path", rb_file_path, 0);
rb_define_global_function("test", rb_f_test, -1);
rb_cStat = rb_define_class_under(rb_cFile, "Stat", rb_cObject);