Skip to content

Instantly share code, notes, and snippets.

@douglasrodrigo
Created March 5, 2013 10:57
Show Gist options
  • Save douglasrodrigo/5089516 to your computer and use it in GitHub Desktop.
Save douglasrodrigo/5089516 to your computer and use it in GitHub Desktop.
import org.jruby.*;
import org.jruby.ast.executable.AbstractScript;
import org.jruby.ast.executable.RuntimeCache;
import org.jruby.internal.runtime.methods.CallConfiguration;
import org.jruby.javasupport.util.RuntimeHelpers;
import org.jruby.runtime.*;
import org.jruby.runtime.builtin.IRubyObject;
public class person extends AbstractScript
{
private static void setPosition(ThreadContext threadcontext, int i)
{
threadcontext.setFileAndLine("person.rb", i);
}
public person()
{
filename = "person.rb";
super.runtimeCache = new RuntimeCache();
initFromDescriptor("puts\uFFFFF\uFFFFdo_something\uFFFFN\uFFFFnew\uFFFFN\uFFFF\002\000\000\000\001\000" +
"\000\000\000\000\000\000\001\001"
);
setEncoding(0, "US-ASCII");
setByteList(0, "something", getEncoding0());
}
public static IRubyObject __file__(person person1, ThreadContext threadcontext, IRubyObject irubyobject, IRubyObject airubyobject[], Block block)
{
class_0$RUBY$Person(person1, threadcontext, RuntimeHelpers.prepareClassNamespace(threadcontext, threadcontext.nil).defineOrGetClassUnder("Person", null), Block.NULL_BLOCK);
return person1.getCallSite1().call(threadcontext, irubyobject, person1.getCallSite2().call(threadcontext, irubyobject, person1.getConstant0(threadcontext, "Person")));
}
public IRubyObject __file__(ThreadContext threadcontext, IRubyObject irubyobject, IRubyObject airubyobject[], Block block)
{
return __file__(this, threadcontext, irubyobject, airubyobject, block);
}
public static IRubyObject class_0$RUBY$Person(person person1, ThreadContext threadcontext, IRubyObject irubyobject, Block block)
{
threadcontext.preCompiledClassDummyScope((RubyModule)irubyobject, person1.getScope0(threadcontext, ",0,0,-1"));
goto _L1
threadcontext.postCompiledClass();
throw ;
_L1:
threadcontext.postCompiledClass();
return RuntimeHelpers.def(threadcontext, irubyobject, person1, "do_something", "method__1$RUBY$do_something", person1.getScope1(threadcontext, ",0,0,-1"), 0, "person.rb", 1, CallConfiguration.FrameNoneScopeNone, "NONE");
}
public static IRubyObject method__1$RUBY$do_something(person person1, ThreadContext threadcontext, IRubyObject irubyobject, Block block)
{
return person1.getCallSite0().call(threadcontext, irubyobject, irubyobject, person1.getString0(threadcontext, 32));
}
public static IRubyObject method__1$RUBY$do_something(person person1, ThreadContext threadcontext, IRubyObject irubyobject, IRubyObject airubyobject[], Block block)
{
RuntimeHelpers.checkArgumentCount(threadcontext, airubyobject, 0);
return method__1$RUBY$do_something(person1, threadcontext, irubyobject, block);
}
public static IRubyObject class_0$RUBY$Person(person person1, ThreadContext threadcontext, IRubyObject irubyobject, IRubyObject airubyobject[], Block block)
{
Arity.checkArgumentCount(threadcontext.getRuntime(), airubyobject, 0, 0);
return class_0$RUBY$Person(person1, threadcontext, irubyobject, block);
}
public IRubyObject load(ThreadContext threadcontext, IRubyObject irubyobject, boolean flag)
{
RuntimeHelpers.preLoad(threadcontext, ",0,0,-2", flag);
RuntimeHelpers.postLoad(threadcontext);
return __file__(this, threadcontext, irubyobject, IRubyObject.NULL_ARRAY, Block.NULL_BLOCK);
RuntimeHelpers.postLoad(threadcontext);
throw ;
}
public static void main(String args[])
{
person person1;
RubyInstanceConfig rubyinstanceconfig;
person1 = new person();
String s;
person1.setFilename(s = person.getClassLoader().getResource("person.class").toString());
rubyinstanceconfig = new RubyInstanceConfig();
rubyinstanceconfig.setArgv(args);
rubyinstanceconfig.setScriptFileName(s);
Ruby ruby;
person1.load((ruby = Ruby.newInstance(rubyinstanceconfig)).getCurrentContext(), ruby.getTopSelf(), false);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment