コード例 #1
0
ファイル: mruby.go プロジェクト: ujun/go-mruby
// 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
ファイル: gomruby.go プロジェクト: AlekSi/gomruby
// 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
ファイル: mruby.go プロジェクト: Gimi/go-mruby
func New() *MRuby {
	return &MRuby{C.mrb_open()}
}