summaryrefslogtreecommitdiff
path: root/eval.c
diff options
context:
space:
mode:
Diffstat (limited to 'eval.c')
-rw-r--r--eval.c27
1 files changed, 27 insertions, 0 deletions
diff --git a/eval.c b/eval.c
index a6a028ab5c..2d05ebe60c 100644
--- a/eval.c
+++ b/eval.c
@@ -1125,6 +1125,33 @@ rb_eval_string_protect(str, state)
}
VALUE
+rb_eval_string_wrap(str, state)
+ const char *str;
+ int *state;
+{
+ int status;
+ VALUE self = ruby_top_self;
+ VALUE val;
+
+ PUSH_CLASS();
+ ruby_class = ruby_wrapper = rb_module_new();
+ ruby_top_self = rb_obj_clone(ruby_top_self);
+ rb_extend_object(self, ruby_class);
+
+ val = rb_eval_string_protect(str, &status);
+ ruby_top_self = self;
+
+ POP_CLASS();
+ if (state) {
+ if (status == 0) {
+ JUMP_TAG(state);
+ }
+ *state = status;
+ }
+ return val;
+}
+
+VALUE
rb_eval_cmd(cmd, arg)
VALUE cmd, arg;
{