File Manager
# Pseudo I/O on String object, with interface corresponding to IO.
#
# Commonly used to simulate `$stdio` or `$stderr`
#
# ### Examples
#
# require 'stringio'
#
# # Writing stream emulation
# io = StringIO.new
# io.puts "Hello World"
# io.string #=> "Hello World\n"
#
# # Reading stream emulation
# io = StringIO.new "first\nsecond\nlast\n"
# io.getc #=> "f"
# io.gets #=> "irst\n"
# io.read #=> "second\nlast\n"
#
class StringIO
# Creates new StringIO instance from with *string* and *mode*.
#
def initialize: (?String string, ?String? mode) -> void
# Equivalent to StringIO.new except that when it is called with a block, it
# yields with the new instance and closes it, and returns the result which
# returned from the block.
#
def self.open: [U] (?String string, ?String? mode) { (StringIO arg) -> U } -> U
def <<: (untyped arg0) -> self
# Puts stream into binary mode. See IO#binmode.
#
def binmode: () -> self
# Closes a StringIO. The stream is unavailable for any further data operations;
# an `IOError` is raised if such an attempt is made.
#
def close: () -> nil
# Closes the read end of a StringIO. Will raise an `IOError` if the receiver is
# not readable.
#
def close_read: () -> nil
# Closes the write end of a StringIO. Will raise an `IOError` if the receiver
# is not writeable.
#
def close_write: () -> nil
# Returns `true` if the stream is completely closed, `false` otherwise.
#
def closed?: () -> bool
# Returns `true` if the stream is not readable, `false` otherwise.
#
def closed_read?: () -> bool
# Returns `true` if the stream is not writable, `false` otherwise.
#
def closed_write?: () -> bool
# See IO#each.
#
def each: (?String sep, ?Integer limit, ?chomp: boolish) { (String) -> untyped } -> self
| (?String sep, ?Integer limit, ?chomp: boolish) -> ::Enumerator[String, self]
# See IO#each_byte.
#
def each_byte: () { (Integer arg0) -> untyped } -> self
| () -> ::Enumerator[Integer, self]
# See IO#each_char.
#
def each_char: () { (String arg0) -> untyped } -> self
| () -> ::Enumerator[String, self]
# See IO#each_codepoint.
#
def each_codepoint: () { (Integer arg0) -> untyped } -> self
| () -> ::Enumerator[Integer, self]
# Returns true if the stream is at the end of the data (underlying string). The
# stream must be opened for reading or an `IOError` will be raised.
#
def eof: () -> bool
# Raises NotImplementedError.
#
def fcntl: (Integer integer_cmd, String | Integer arg) -> Integer
# Returns `nil`. Just for compatibility to IO.
#
def fileno: () -> nil
# Returns an object itself. Just for compatibility to IO.
#
def flush: () -> self
# Returns 0. Just for compatibility to IO.
#
def fsync: () -> Integer?
# See IO#getbyte.
#
def getbyte: () -> Integer?
# See IO#getc.
#
def getc: () -> String?
# See IO#gets.
#
def gets: (?String sep, ?Integer limit, ?chomp: boolish) -> String?
# Returns the Encoding of the internal string if conversion is specified.
# Otherwise returns `nil`.
#
def internal_encoding: () -> Encoding
# Returns the Encoding object that represents the encoding of the file. If the
# stream is write mode and no encoding is specified, returns `nil`.
#
def external_encoding: () -> Encoding
# Returns `false`. Just for compatibility to IO.
#
def isatty: () -> bool
# Returns the current line number. The stream must be opened for reading.
# `lineno` counts the number of times `gets` is called, rather than the number
# of newlines encountered. The two values will differ if `gets` is called with
# a separator other than newline. See also the `$.` variable.
#
def lineno: () -> Integer
# Manually sets the current line number to the given value. `$.` is updated only
# on the next read.
#
def lineno=: (Integer arg0) -> Integer
# Returns `nil`. Just for compatibility to IO.
#
def pid: () -> nil
# Returns the current offset (in bytes).
#
def pos: () -> Integer
# Seeks to the given position (in bytes).
#
def pos=: (Integer arg0) -> Integer
def print: (*untyped arg0) -> nil
def printf: (String format_string, *untyped arg0) -> nil
# See IO#putc.
#
def putc: (Numeric | String arg0) -> untyped
def puts: (*untyped arg0) -> nil
# See IO#read.
#
def read: (?Integer length, ?String outbuf) -> String?
def read_nonblock: (Integer len) -> String
| (Integer len, ?String buf) -> String
def readbyte: () -> Integer
def readchar: () -> String
def readline: (?String sep, ?Integer limit) -> String
# See IO#readlines.
#
def readlines: (?String sep, ?Integer limit, ?chomp: boolish) -> ::Array[String]
def readpartial: (Integer maxlen) -> String
| (Integer maxlen, ?String outbuf) -> String
# Reinitializes the stream with the given *other_StrIO* or *string* and *mode*
# (see StringIO#new).
#
def reopen: (StringIO other) -> self
| (String other, ?String mode_str) -> self
# Positions the stream to the beginning of input, resetting `lineno` to zero.
#
def rewind: () -> Integer
# Seeks to a given offset *amount* in the stream according to the value of
# *whence* (see IO#seek).
#
def seek: (Integer amount, ?Integer whence) -> Integer
# Specify the encoding of the StringIO as *ext_enc*. Use the default external
# encoding if *ext_enc* is nil. 2nd argument *int_enc* and optional hash *opt*
# argument are ignored; they are for API compatibility to IO.
#
def set_encoding: (?String | Encoding ext_or_ext_int_enc) -> self
| (?String | Encoding ext_or_ext_int_enc, ?String | Encoding int_enc) -> self
# Returns underlying String object, the subject of IO.
#
def string: () -> String
# Changes underlying String object, the subject of IO.
#
def string=: (String str) -> String
# Returns the size of the buffer string.
#
def size: () -> Integer
# Returns `true` always.
#
def sync: () -> bool
# Returns the argument unchanged. Just for compatibility to IO.
#
def sync=: (boolish) -> bool
def sysread: (Integer maxlen, String outbuf) -> String
def syswrite: (String arg0) -> Integer
# Returns the current offset (in bytes).
#
def tell: () -> Integer
# Returns `false`. Just for compatibility to IO.
#
def tty?: () -> bool
# See IO#ungetbyte
#
def ungetbyte: (String | Integer arg0) -> nil
# Pushes back one character (passed as a parameter) such that a subsequent
# buffered read will return it. There is no limitation for multiple pushbacks
# including pushing back behind the beginning of the buffer string.
#
def ungetc: (String arg0) -> nil
# Appends the given string to the underlying buffer string. The stream must be
# opened for writing. If the argument is not a string, it will be converted to
# a string using `to_s`. Returns the number of bytes written. See IO#write.
#
def write: (String arg0) -> Integer
# This is a deprecated alias for #each_byte.
#
def bytes: () { (Integer arg0) -> untyped } -> self
| () -> ::Enumerator[Integer, self]
# This is a deprecated alias for #each_char.
#
def chars: () { (String arg0) -> untyped } -> self
| () -> ::Enumerator[String, self]
# This is a deprecated alias for #each_codepoint.
#
def codepoints: () { (Integer arg0) -> untyped } -> self
| () -> ::Enumerator[Integer, self]
# See IO#each.
#
def each_line: (?String sep, ?Integer limit, ?chomp: boolish) { (String) -> untyped } -> self
| (?String sep, ?Integer limit, ?chomp: boolish) -> ::Enumerator[String, self]
# Returns true if the stream is at the end of the data (underlying string). The
# stream must be opened for reading or an `IOError` will be raised.
#
def eof?: () -> bool
# This is a deprecated alias for #each_line.
#
def lines: (?String sep, ?Integer limit) { (String arg0) -> untyped } -> self
| (?String sep, ?Integer limit) -> ::Enumerator[String, self]
end
File Manager Version 1.0, Coded By Lucas
Email: hehe@yahoo.com