Sha256: b097260c578a41e319897046b9ecc260cb974e700d160f392f70ae238413bfab
Contents?: true
Size: 967 Bytes
Versions: 17
Compression:
Stored size: 967 Bytes
Contents
#include "tester.h" #include <vector> #include "defs.h" using namespace Rucy; static std::vector<Xot::String> logs; void log (const char* str) { logs.push_back(str); } /* return all logs. */ VALUE all_logs(VALUE self) { std::vector<Value> a; for (size_t i = 0; i < logs.size(); ++i) a.push_back(logs[i].c_str()); return value(a.size(), &a[0]); } /* clcear all logs. */ VALUE clear_logs(VALUE self) { logs.clear(); } void Init_value (); void Init_exception (); void Init_function (); void Init_struct (); void Init_class (); extern "C" void Init_tester () { RUCY_TRY init(); Module mRucy = rb_define_module("Rucy"); Module mTester = rb_define_module_under(mRucy, "Tester"); rb_define_module_function(mTester, "all_logs", RUBY_METHOD_FUNC(all_logs), 0); rb_define_module_function(mTester, "clear_logs", RUBY_METHOD_FUNC(clear_logs), 0); Init_value(); Init_exception(); Init_function(); Init_struct (); Init_class (); RUCY_CATCH }
Version data entries
17 entries across 17 versions & 1 rubygems