Project

General

Profile

Actions

Feature #177

closed

IO#binmode?

Added by usa (Usaku NAKAMURA) almost 16 years ago. Updated almost 13 years ago.

Status:
Closed
Assignee:
-
Target version:
-
[ruby-dev:35148]

Description

=begin
こんにちは、なかむら(う)です。

IO#binmode? というメソッドがあるとうれしいことがあるんじゃな
いかという気がしました。

Windowsとかじゃないと意味ないですが。

1.9.0-2の後になると思いますが、入れてもいいでしょうか?

Index: io.c

--- io.c (revision 17388)
+++ io.c (working copy)
@@ -3167,6 +3167,20 @@ rb_io_binmode_m(VALUE io)
return io;
}

+/*

    • call-seq:
    • ios.binmode?    => true or false
      
    • Returns true if ios is binmode.
  • */
    +static VALUE
    +rb_io_binmode_p(VALUE io)
    +{
  • rb_io_t *fptr;
  • GetOpenFile(io, fptr);
  • return fptr->mode & FMODE_BINMODE ? Qtrue : Qfalse;
    +}

static const char*
rb_io_flags_mode(int flags)
{
@@ -7703,6 +7717,7 @@ Init_IO(void)
rb_define_method(rb_cIO, "isatty", rb_io_isatty, 0);
rb_define_method(rb_cIO, "tty?", rb_io_isatty, 0);
rb_define_method(rb_cIO, "binmode", rb_io_binmode_m, 0);

  • rb_define_method(rb_cIO, "binmode?", rb_io_binmode_p, 0);
    rb_define_method(rb_cIO, "sysseek", rb_io_sysseek, -1);

    rb_define_method(rb_cIO, "ioctl", rb_io_ioctl, -1);

    それでは。
    --
    U.Nakamura
    =end

Actions

Also available in: Atom PDF

Like0
Like0Like0