Class: Gem::SafeMarshal::Reader
- Inherits:
-
Object
- Object
- Gem::SafeMarshal::Reader
- Defined in:
- lib/rubygems/safe_marshal/reader.rb
Defined Under Namespace
Classes: DataTooShortError, EOFError, Error, LengthTooLongError, NegativeLengthError, NotImplementedError, UnconsumedBytesError, UnsupportedVersionError
Instance Method Summary collapse
-
#initialize(io) ⇒ Reader
constructor
A new instance of Reader.
- #read! ⇒ Object
Constructor Details
#initialize(io) ⇒ Reader
Returns a new instance of Reader.
32 33 34 35 36 |
# File 'lib/rubygems/safe_marshal/reader.rb', line 32 def initialize(io) @io = io @object_links = {} @symbol_links = {} end |
Instance Method Details
#read! ⇒ Object
38 39 40 41 42 43 |
# File 'lib/rubygems/safe_marshal/reader.rb', line 38 def read! read_header root = read_element raise UnconsumedBytesError, "expected EOF, got #{@io.read(10).inspect}... after top-level element #{root.class}" unless @io.eof? root end |