Files
project_misth/include/binding/ruby.h
T
syedm 55f4b4d933 Add basic app interface
- Add pool struct for data pools
2026-05-04 15:49:54 +01:00

26 lines
503 B
C++

#include "pch.h"
#include "utils.h"
namespace Ruby {
extern mrb_state *mrb;
struct Block {
mrb_value proc;
Block(mrb_value proc) : proc(proc) {
mrb_gc_register(mrb, proc);
}
Block() : proc(mrb_nil_value()) {}
Block(const Block &) = delete;
Block &operator=(const Block &) = delete;
mrb_value call(int argc = 0, mrb_value *argv = nullptr) const {
return mrb_funcall(mrb, proc, "call", argc, argv);
}
~Block() {
mrb_gc_unregister(mrb, proc);
}
};
}; // namespace Ruby