# Ruby\_top\_self in 1.9

**URL:** <https://www.ruby-forum.com/t/ruby-top-self-in-1-9/169694>\
**Category:** Ruby\
**Created:** [June 7, 2009, 5:43am UTC](https://www.ruby-forum.com/t/ruby-top-self-in-1-9/169694 "2009-06-07T05:43:59Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![rogerdpack](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/r/45deac/32.png) [@rogerdpack](https://www.ruby-forum.com/u/rogerdpack)\
**Post date:** [June 7, 2009, 5:43am UTC](https://www.ruby-forum.com/t/ruby-top-self-in-1-9/169694/1 "2009-06-07T05:43:59Z")

</div>

with ruby 1.8 C code, I can (apparently) do the following to define a  
top level method called “go”

file Test3.c

static void toplevel\_scope\_1(VALUE self, NODE \*cref) {  
VALUE s\_class = (cref)-\>nd\_clss;  
rb\_define\_private\_method(s\_class, “go”, method\_1, -1);  
}

void Init\_test3() {  
NODE \*cref = rb\_node\_newnode(NODE\_CREF, rb\_cObject, 0, 0);  
toplevel\_scope\_1(ruby\_top\_self, cref);  
}

So anybody have any clues how to do that in 1.9?  
Thanks!  
-=r
