[yast-commit] r67454 - /trunk/ruby-bindings/src/ruby/YRuby.cc
Author: jreidinger Date: Wed Feb 15 16:53:47 2012 New Revision: 67454 URL: http://svn.opensuse.org/viewcvs/yast?rev=67454&view=rev Log: and implement injection of last exception message Modified: trunk/ruby-bindings/src/ruby/YRuby.cc Modified: trunk/ruby-bindings/src/ruby/YRuby.cc URL: http://svn.opensuse.org/viewcvs/yast/trunk/ruby-bindings/src/ruby/YRuby.cc?rev=67454&r1=67453&r2=67454&view=diff ============================================================================== --- trunk/ruby-bindings/src/ruby/YRuby.cc (original) +++ trunk/ruby-bindings/src/ruby/YRuby.cc Wed Feb 15 16:53:47 2012 @@ -56,6 +56,17 @@ #include "Y2RubyTypeConv.h" +void inject_last_exception_method(VALUE& module,const string& message, const string& module_name) +{ + //doing injection from C++ is quite complex, but we have eval, so we can do it in ruby :) + string code("module "); + code += module_name; + code += "\ndef self.last_exception\n'"; + code += message; + code += "'\nend\nend"; + rb_funcall(module, rb_intern("eval"), 1, rb_str_new2(code.c_str())); +} + static void prependModulePath() { YCPPathSearch::initialize (); @@ -248,6 +259,7 @@ { return YCPString(StringValuePtr(reason)); } + inject_last_exception_method(module,StringValuePtr(reason),module_name); return YCPVoid(); } else -- To unsubscribe, e-mail: yast-commit+unsubscribe@opensuse.org For additional commands, e-mail: yast-commit+help@opensuse.org
participants (1)
-
jreidinger@svn2.opensuse.org