Skip to content

Commit

Permalink
Added rb_frame_this_func.
Browse files Browse the repository at this point in the history
  • Loading branch information
brixen committed Jul 5, 2012
1 parent 66c15a6 commit 322d2ff
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 0 deletions.
3 changes: 3 additions & 0 deletions vm/capi/18/include/ruby.h
Expand Up @@ -1114,6 +1114,9 @@ VALUE rb_uint2big(unsigned long number);
/** Return name of the function being called */
ID rb_frame_last_func();

/** Return name of the current Ruby method */
ID rb_frame_this_func();

VALUE rb_exec_recursive(VALUE (*func)(VALUE, VALUE, int),
VALUE obj, VALUE arg);

Expand Down
3 changes: 3 additions & 0 deletions vm/capi/19/include/ruby/ruby.h
Expand Up @@ -1233,6 +1233,9 @@ VALUE rb_uint2big(unsigned long number);
/** Return name of the function being called */
ID rb_frame_last_func();

/** Return name of the current Ruby method */
ID rb_frame_this_func();

VALUE rb_exec_recursive(VALUE (*func)(VALUE, VALUE, int),
VALUE obj, VALUE arg);

Expand Down
8 changes: 8 additions & 0 deletions vm/capi/module.cpp
Expand Up @@ -48,6 +48,14 @@ extern "C" {
return env->get_handle(rcf->name());
}

ID rb_frame_this_func() {
NativeMethodEnvironment* env = NativeMethodEnvironment::get();

CallFrame* rcf = env->current_call_frame()->top_ruby_frame();

return env->get_handle(rcf->name());
}

static VALUE const_missing(VALUE klass, ID id) {
return rb_funcall(klass, rb_intern("const_missing"), 1, ID2SYM(id));
}
Expand Down

0 comments on commit 322d2ff

Please sign in to comment.