Пример #1
0
// NewMrb creates a new instance of Mrb, representing the state of a single
// Ruby VM.
//
// When you're finished with the VM, clean up all resources it is using
// by calling the Close method.
func NewMrb() *Mrb {
	state := C.mrb_open()

	return &Mrb{
		state: state,
	}
}
Пример #2
0
// Creates new mruby VM. Panics if it's not possible.
func New() *MRuby {
	state := C.mrb_open()
	if state == nil {
		panic(errors.New("gomruby bug: failed to create mruby state"))
	}
	return &MRuby{state}
}
Пример #3
0
func New() *MRuby {
	return &MRuby{C.mrb_open()}
}