Java Code Examples for org.jruby.runtime.builtin.IRubyObject#getRuntime()
The following examples show how to use
org.jruby.runtime.builtin.IRubyObject#getRuntime() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: JRubyRuntimeContext.java From asciidoctorj with Apache License 2.0 | 5 votes |
public static Ruby get(ContentNode node) { if (node instanceof IRubyObject) { return ((IRubyObject) node).getRuntime(); } else if (node instanceof RubyObjectHolderProxy) { return ((RubyObjectHolderProxy) node).__ruby_object().getRuntime(); } else if (node instanceof ContentNodeImpl) { IRubyObject nodeDelegate = ((ContentNodeImpl) node).getRubyObject(); return nodeDelegate.getRuntime(); } else { throw new IllegalArgumentException("Don't know what to with a " + node); } }
Example 2
Source File: MarathonRuby.java From marathonv5 with Apache License 2.0 | 4 votes |
public ContextAccessor(IRubyObject o) { this.o = o; Ruby runtime = o.getRuntime(); marathon = runtime.evalScriptlet("$marathon"); }
Example 3
Source File: NodeConverter.java From asciidoctorj with Apache License 2.0 | 4 votes |
/** * @param object * @return {@code true} if the given Ruby object is recognized as this node type. */ public boolean isInstance(IRubyObject object) { Ruby rubyRuntime = object.getRuntime(); return getRubyClass(rubyRuntime).equals(object.getMetaClass().getRealClass()); }
Example 4
Source File: RubyObjectWrapper.java From asciidoctorj with Apache License 2.0 | 4 votes |
public RubyObjectWrapper(IRubyObject rubyNode) { this.rubyNode = rubyNode; this.runtime = rubyNode.getRuntime(); }
Example 5
Source File: JRubyRackApplication.java From rack-servlet with Apache License 2.0 | 2 votes |
/** * <p>Creates a {@link RackApplication} that delegates to the given Ruby Rack application.</p> * * <p>To obtain the necessary {@link IRubyObject}, you can create a JRuby * {@link org.jruby.embed.ScriptingContainer} and {@link org.jruby.embed.ScriptingContainer#parse} * and {@link org.jruby.embed.EmbedEvalUnit#run()} your Ruby code. See our examples for concrete * code.</p> * * @param application the Ruby Rack application. */ public JRubyRackApplication(IRubyObject application) { this.application = application; this.runtime = application.getRuntime(); this.threadService = runtime.getThreadService(); }