Method: Pathname#open

Defined in:
pathname.c

#openObject #open(mode = "r"[, opt]) ⇒ File #open([mode [, perm]][, opt]) ⇒ File #open(mode = "r"[, opt]) {|file| ... } ⇒ Object #open([mode [, perm]][, opt]) {|file| ... } ⇒ Object

Opens the file for reading or writing.

See File.open.

Overloads:

  • #open(mode = "r"[, opt]) ⇒ File

    Returns:

    • (File)
  • #open([mode [, perm]][, opt]) ⇒ File

    Returns:

    • (File)
  • #open(mode = "r"[, opt]) {|file| ... } ⇒ Object

    Yields:

    • (file)

    Returns:

    • (Object)
  • #open([mode [, perm]][, opt]) {|file| ... } ⇒ Object

    Yields:

    • (file)

    Returns:

    • (Object)


641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
# File 'pathname.c', line 641

static VALUE
path_open(int argc, VALUE *argv, VALUE self)
{
    VALUE args[4];
    int n;

    args[0] = get_strpath(self);
    n = rb_scan_args(argc, argv, "03", &args[1], &args[2], &args[3]);
    if (rb_block_given_p()) {
        return rb_block_call_kw(rb_cFile, id_open, 1+n, args, 0, 0, RB_PASS_CALLED_KEYWORDS);
    }
    else {
        return rb_funcallv_kw(rb_cFile, id_open, 1+n, args, RB_PASS_CALLED_KEYWORDS);
    }
}