Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ParallelDecode ¶
func ParallelDecode(r io.Reader, para uint) (<-chan RubyObject, <-chan error)
ParallelDecode will use many goroutines to decode io.Reader. io.Reader MUST present JSON objects seperated by \n characters.
Decoding will use para + 1 goroutines:
1 x goroutines to read all the lines in the io.Reader para x goroutines to decode the lines
The decoding will continue until it reaches EOF in the io.Reader, and return all the errors it encountered on the error channel, including Read errors, unmarshalling errors and loading errors.
Types ¶
type Decoder ¶
type Decoder struct {
// contains filtered or unexported fields
}
Decoder decodes RubyObjects from an io.Reader. It wraps a json.Decoder and is pretty slow, but simple to use for those acustomed to the json.Decoder from the stdlib.
func NewDecoder ¶
NewDecoder returns a trivial decoder wrapping a json.Decoder of the stdlib. It is pretty slow but simple to use.
For performance, prefer ParallelDecode.
func (*Decoder) Decode ¶
func (d *Decoder) Decode(rObj *RubyObject) (err error)
Decode decodes a ruby object from the underlying io.Reader.
type Encoder ¶
type Encoder struct {
// contains filtered or unexported fields
}
Encoder encodes RubyObjects to an io.Writer. It wraps a json.Encoder and is pretty slow, but simple to use for those acustomed to the json.Encoder from the stdlib.
func NewEncoder ¶
NewEncoder returns a trivial encoder wrapping a json.Encoder of the stdlib. It is pretty slow but simple to use.
func (*Encoder) Encode ¶
func (e *Encoder) Encode(rObj *RubyObject) (err error)
Encode encodes the object onto the underlying io.Writer.
type RubyObject ¶
type RubyObject struct { Type RubyType Value interface{} Name string NodeType string Address uint64 Class uint64 References []uint64 Default uint64 Generation uint64 Bytesize uint64 Fd int File string Encoding string Method string Ivars uint64 Length uint64 Line uint64 Memsize uint64 Capacity uint64 Size uint64 Struct string // contains filtered or unexported fields }
RubyObject is the deserialized form of an object in an ObjectSpace dump.
func (RubyObject) Broken ¶
func (ro RubyObject) Broken() bool
func (RubyObject) Embedded ¶
func (ro RubyObject) Embedded() bool
func (RubyObject) Frozen ¶
func (ro RubyObject) Frozen() bool
func (RubyObject) Fstring ¶
func (ro RubyObject) Fstring() bool
func (RubyObject) GcMarked ¶
func (ro RubyObject) GcMarked() bool
func (RubyObject) GcOld ¶
func (ro RubyObject) GcOld() bool
func (RubyObject) GcWbProtected ¶
func (ro RubyObject) GcWbProtected() bool
func (RubyObject) Shared ¶
func (ro RubyObject) Shared() bool