Method: StringIO#initialize
- Defined in:
- ext/stringio/stringio.c
#new(string = '', mode = 'r+') ⇒ Object
Note that mode defaults to 'r' if string is frozen.
Returns a new StringIO instance formed from string and mode; see Access Modes:
strio = StringIO.new # => #<StringIO>
strio.close
The instance should be closed when no longer needed.
Related: StringIO.open (accepts block; closes automatically).
195 196 197 198 199 200 201 202 203 204 205 |
# File 'ext/stringio/stringio.c', line 195 static VALUE strio_initialize(int argc, VALUE *argv, VALUE self) { struct StringIO *ptr = check_strio(self); if (!ptr) { DATA_PTR(self) = ptr = strio_alloc(); } rb_call_super(0, 0); return strio_init(argc, argv, ptr, self); } |