mirror of
https://github.com/ruby/ruby.git
synced 2026-01-27 04:24:23 +00:00
[ruby/stringio] [DOC] Tweaks for StringIO.open
(https://github.com/ruby/stringio/pull/146) https://github.com/ruby/stringio/commit/141c6c0edf
This commit is contained in:
parent
4368e6c42e
commit
f762e50bcb
@ -370,23 +370,20 @@ strio_finalize(VALUE self)
|
||||
|
||||
/*
|
||||
* call-seq:
|
||||
* StringIO.open(string = '', mode = 'r+') {|strio| ... }
|
||||
* StringIO.open(string = '', mode = 'r+') -> new_stringio
|
||||
* StringIO.open(string = '', mode = 'r+') {|strio| ... } -> object
|
||||
*
|
||||
* Note that +mode+ defaults to <tt>'r'</tt> if +string+ is frozen.
|
||||
* Creates new \StringIO instance by calling <tt>StringIO.new(string, mode)</tt>.
|
||||
*
|
||||
* Creates a new \StringIO instance formed from +string+ and +mode+;
|
||||
* see {Access Modes}[rdoc-ref:File@Access+Modes].
|
||||
*
|
||||
* With no block, returns the new instance:
|
||||
* With no block given, returns the new instance:
|
||||
*
|
||||
* strio = StringIO.open # => #<StringIO>
|
||||
*
|
||||
* With a block, calls the block with the new instance
|
||||
* With a block given, calls the block with the new instance
|
||||
* and returns the block's value;
|
||||
* closes the instance on block exit.
|
||||
* closes the instance on block exit:
|
||||
*
|
||||
* StringIO.open {|strio| p strio }
|
||||
* # => #<StringIO>
|
||||
* StringIO.open('foo') {|strio| strio.string.upcase } # => "FOO"
|
||||
*
|
||||
* Related: StringIO.new.
|
||||
*/
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user