use of org.jruby.RubyObject in project nokogiri by sparklemotion.
the class NokogiriHandler method isFromFragmentHandler.
private boolean isFromFragmentHandler() {
if (object != null && object instanceof RubyObject) {
RubyObject rubyObj = (RubyObject) object;
IRubyObject document = rubyObj.getInstanceVariable("@document");
if (document != null) {
String name = document.getMetaClass().getName();
if ("Nokogiri::XML::FragmentHandler".equals(name)) {
return true;
}
}
}
return false;
}
use of org.jruby.RubyObject in project gocd by gocd.
the class NokogiriHandler method isFromFragmentHandler.
private boolean isFromFragmentHandler() {
if (object != null && object instanceof RubyObject) {
RubyObject rubyObj = (RubyObject) object;
IRubyObject document = rubyObj.getInstanceVariable("@document");
if (document != null) {
String name = document.getMetaClass().getName();
if ("Nokogiri::XML::FragmentHandler".equals(name)) {
return true;
}
}
}
return false;
}
use of org.jruby.RubyObject in project cucumber-jvm by cucumber.
the class JRubyBackend method executeStepdef.
void executeStepdef(RubyObject stepdef, I18n i18n, Object[] args) {
ArrayList<IRubyObject> jrubyArgs = new ArrayList<IRubyObject>();
// jrubyWorld.@__gherkin_i18n = i18n
RubyObject jrubyI18n = (RubyObject) JavaEmbedUtils.javaToRuby(stepdef.getRuntime(), i18n);
currentWorld.callMethod("instance_variable_set", new IRubyObject[] { stepdef.getRuntime().newSymbol("@__gherkin_i18n"), jrubyI18n });
jrubyArgs.add(currentWorld);
for (Object o : args) {
if (o == null) {
jrubyArgs.add(null);
} else if (o instanceof DataTable) {
//Add a datatable as it stands...
jrubyArgs.add(JavaEmbedUtils.javaToRuby(stepdef.getRuntime(), o));
} else {
jrubyArgs.add(stepdef.getRuntime().newString((String) o));
}
}
stepdef.callMethod("execute", jrubyArgs.toArray(new IRubyObject[jrubyArgs.size()]));
}
Aggregations