Sha256: bbc54a1c5c69dbb1efd803932e0b8da2b6cfbc13f858b30a8e462ef3e755580a
Contents?: true
Size: 953 Bytes
Versions: 9
Compression:
Stored size: 953 Bytes
Contents
#include "tester.h" #include <vector> #include "rucy.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_function(mTester, "all_logs", RUBY_METHOD_FUNC(all_logs), 0); rb_define_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
9 entries across 9 versions & 1 rubygems