mirror of
https://github.com/jimeh/rbheap.git
synced 2026-02-19 12:56:46 +00:00
Ensure all exported functions and types have descriptive comments
This commit is contained in:
@@ -4,6 +4,8 @@ import "encoding/json"
|
||||
|
||||
//go:generate easyjson -all object.go
|
||||
|
||||
// NewObject returns a new *Object instance with it's attributes populated from
|
||||
// the given input JSON data.
|
||||
func NewObject(inputJSON []byte) (*Object, error) {
|
||||
var obj Object
|
||||
err := json.Unmarshal(inputJSON, &obj)
|
||||
@@ -11,11 +13,14 @@ func NewObject(inputJSON []byte) (*Object, error) {
|
||||
return &obj, err
|
||||
}
|
||||
|
||||
// Object is a minimal representation of a Ruby heap object as exported from
|
||||
// Ruby via `ObjectSpace.dump_all`.
|
||||
type Object struct {
|
||||
Address string `json:"address"`
|
||||
Type string `json:"type"`
|
||||
}
|
||||
|
||||
// Index returns a unique index for the given Object.
|
||||
func (s *Object) Index() string {
|
||||
return s.Address + ":" + s.Type
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user