This is a Ruby tree! It shows every object from the Ruby Programming Language in a tree format.

ungetc

        # IO.ungetc

(from ruby core)
---
    ios.ungetc(integer)  -> nil
    ios.ungetc(string)   -> nil

---

Pushes back characters (passed as a parameter) onto *ios*, such that a
subsequent buffered read will return it. It is only guaranteed to
support a single byte, and only if ungetbyte or ungetc has not already
been called on *ios* since the previous read of at least a single byte
from *ios*. However, it can support additional bytes if there is space
in the internal buffer to allow for it.

    f = File.new("testfile")   #=> #<File:testfile>
    c = f.getc                 #=> "8"
    f.ungetc(c)                #=> nil
    f.getc                     #=> "8"

If given an integer, the integer must represent a valid codepoint in the
external encoding of *ios*.

Calling this method prepends to the existing buffer, even if the method
has already been called previously:

    f = File.new("testfile")   #=> #<File:testfile>
    f.ungetc("ab")             #=> nil
    f.ungetc("cd")             #=> nil
    f.read(5)                  #=> "cdab8"

Has no effect with unbuffered reads (such as IO#sysread).



      

This is MURDOC! A Ruby documentation browser inspired by Smalltalk-80. It allows you to learn about Ruby by browsing through its class hierarchies, and see any of its methods.