Method: StringIO#length

Defined in:
ext/stringio/stringio.c

#lengthInteger #sizeInteger

Returns the size of the buffer string.

Overloads:

  • #lengthInteger

    Returns:

    • (Integer)
  • #sizeInteger

    Returns:

    • (Integer)


1658
1659
1660
1661
1662
1663
1664
1665
1666
# File 'ext/stringio/stringio.c', line 1658

static VALUE
strio_size(VALUE self)
{
    VALUE string = StringIO(self)->string;
    if (NIL_P(string)) {
	rb_raise(rb_eIOError, "not opened");
    }
    return ULONG2NUM(RSTRING_LEN(string));
}