Method: StringIO#binmode

Defined in:
ext/stringio/stringio.c

#binmodeself

Sets the data mode in self to binary mode; see Data Mode.

Returns:

  • (self)


675
676
677
678
679
680
681
682
683
684
685
686
# File 'ext/stringio/stringio.c', line 675

static VALUE
strio_binmode(VALUE self)
{
    struct StringIO *ptr = StringIO(self);
    rb_encoding *enc = rb_ascii8bit_encoding();

    ptr->enc = enc;
    if (WRITABLE(self)) {
  rb_enc_associate(ptr->string, enc);
    }
    return self;
}