string=(p1)
public
Changes underlying String object, the subject of
IO.
Show source
/*
* call-seq:
* strio.string = string -> string
*
* Changes underlying String object, the subject of IO.
*/
static VALUE
strio_set_string(self, string)
VALUE self, string;
{
struct StringIO *ptr = StringIO(self);
if (!OBJ_TAINTED(self)) rb_secure(4);
ptr->flags &= ~FMODE_READWRITE;
StringValue(string);
ptr->flags = OBJ_FROZEN(string) ? FMODE_READABLE : FMODE_READWRITE;
ptr->pos = 0;
ptr->lineno = 0;
return ptr->string = string;
}