Method: StringIO#binmode

Defined in:
stringio.c

#binmodeself

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

Returns:

  • (self)


689
690
691
692
693
694
695
696
697
698
699
700
# File 'stringio.c', line 689

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;
}