public static IRubyObject getInstanceVariableNoWarn(IRubyObject self, ThreadContext context, String internedName) { IRubyObject result = self.getInstanceVariables().getInstanceVariable(internedName); if (result != null) return result; return context.nil; }
public static IRubyObject getInstanceVariableNoWarn(IRubyObject self, ThreadContext context, String internedName) { IRubyObject result = self.getInstanceVariables().getInstanceVariable(internedName); if (result != null) return result; return context.nil; }
@Override public IRubyObject call(ThreadContext context, IRubyObject self, RubyModule clazz, String name) { IRubyObject javaInterfaces = self.getInstanceVariables().getInstanceVariable("@java_interfaces"); if (javaInterfaces != null) return javaInterfaces.dup(); return context.nil; } });
@Override public IRubyObject call(ThreadContext context, IRubyObject self, RubyModule clazz, String name) { IRubyObject javaInterfaces = self.getInstanceVariables().getInstanceVariable("@java_interfaces"); if (javaInterfaces != null) return javaInterfaces.dup(); return context.nil; } });
@Override public IRubyObject call(ThreadContext context, IRubyObject self, RubyModule clazz, String name) { IRubyObject javaInterfaces = self.getInstanceVariables().getInstanceVariable("@java_interfaces"); if (javaInterfaces != null) return javaInterfaces.dup(); return context.runtime.getNil(); } });
@JRubyMethod public static IRubyObject extend_proxy(ThreadContext context, IRubyObject self, IRubyObject proxyClass) { return proxyClass.callMethod(context, "class_eval", IRubyObject.NULL_ARRAY, ((RubyProc)self.getInstanceVariables().getInstanceVariable("@block")).getBlock()); } }
@JRubyMethod public static IRubyObject extend_proxy(ThreadContext context, IRubyObject self, IRubyObject proxyClass) { return proxyClass.callMethod(context, "class_eval", IRubyObject.NULL_ARRAY, ((RubyProc)self.getInstanceVariables().getInstanceVariable("@block")).getBlock()); } }
public static IRubyObject getInstanceVariable(IRubyObject self, Ruby runtime, String internedName) { IRubyObject result = self.getInstanceVariables().getInstanceVariable(internedName); if (result != null) return result; if (runtime.isVerbose()) warnAboutUninitializedIvar(runtime, internedName); return runtime.getNil(); }
public static IRubyObject getInstanceVariable(IRubyObject self, Ruby runtime, String internedName) { IRubyObject result = self.getInstanceVariables().getInstanceVariable(internedName); if (result != null) return result; if (runtime.isVerbose()) warnAboutUninitializedIvar(runtime, internedName); return runtime.getNil(); }
@JRubyMethod public static IRubyObject extend_proxy(ThreadContext context, IRubyObject self, IRubyObject proxyClass) { return proxyClass.callMethod(context, "class_eval", IRubyObject.NULL_ARRAY, ((RubyProc)self.getInstanceVariables().getInstanceVariable("@block")).getBlock()); } }
@JRubyMethod public static IRubyObject extend_proxy(ThreadContext context, IRubyObject self, IRubyObject proxyClass) { return proxyClass.callMethod(context, "class_eval", IRubyObject.NULL_ARRAY, ((RubyProc)self.getInstanceVariables().getInstanceVariable("@block")).getBlock()); } }
public static IRubyObject getInstanceVariable(IRubyObject self, Ruby runtime, String internedName) { IRubyObject result = self.getInstanceVariables().getInstanceVariable(internedName); if (result != null) return result; if (runtime.isVerbose()) warnAboutUninitializedIvar(runtime, internedName); return runtime.getNil(); }
@Override public IRubyObject call(ThreadContext context, IRubyObject self, RubyModule clazz, String name, IRubyObject arg) { IRubyObject javaInterfaces = self.getInstanceVariables().getInstanceVariable("@java_interfaces"); if (javaInterfaces != null && ((RubyArray) javaInterfaces).includes(context, arg)) { return Helpers.invoke(context, arg, "implement", self); } return context.runtime.getNil(); } });
public static NodeCache get(IRubyObject rubyObject) { RubyHash cache = (RubyHash) rubyObject.getInstanceVariables().getInstanceVariable(ASCIIDOCTORJ_CACHE); if (cache == null) { cache = RubyHash.newHash(rubyObject.getRuntime()); rubyObject.getInstanceVariables().setInstanceVariable(ASCIIDOCTORJ_CACHE, cache); } return new NodeCache(cache); }
@Override public IRubyObject call(ThreadContext context, IRubyObject self, RubyModule clazz, String name, IRubyObject arg, Block block) { if (!(arg instanceof RubyClass)) { throw context.runtime.newTypeError("append_features called with non-class"); } RubyClass target = (RubyClass)arg; RubyArray javaInterfaceMods = (RubyArray)self.getInstanceVariables().getInstanceVariable("@java_interface_mods"); target.include(javaInterfaceMods.toJavaArray()); return Helpers.invokeAs(context, clazz.getSuperClass(), self, name, arg, block); } });
public static NodeCache get(IRubyObject rubyObject) { RubyHash cache = (RubyHash) rubyObject.getInstanceVariables().getInstanceVariable(ASCIIDOCTORJ_CACHE); if (cache == null) { cache = RubyHash.newHash(rubyObject.getRuntime()); rubyObject.getInstanceVariables().setInstanceVariable(ASCIIDOCTORJ_CACHE, cache); } return new NodeCache(cache); }
@Override public IRubyObject call(ThreadContext context, IRubyObject self, RubyModule clazz, String name, IRubyObject arg, Block block) { if (!(arg instanceof RubyClass)) { throw context.runtime.newTypeError("append_features called with non-class"); } RubyClass target = (RubyClass)arg; RubyArray javaInterfaceMods = (RubyArray)self.getInstanceVariables().getInstanceVariable("@java_interface_mods"); target.include(javaInterfaceMods.toJavaArray()); return Helpers.invokeAs(context, clazz.getSuperClass(), self, name, arg, block); } });
@JRubyMethod(name = "new", rest = true) public static IRubyObject rbNew(ThreadContext context, IRubyObject self, IRubyObject[] args, Block block) { Ruby runtime = context.runtime; RubyClass implClass = (RubyClass)self.getInstanceVariables().getInstanceVariable("@__implementation"); if (implClass == null) { implClass = RubyClass.newClass(runtime, (RubyClass)runtime.getClass("InterfaceJavaProxy")); implClass.include(new IRubyObject[] {self}); Helpers.setInstanceVariable(implClass, self, "@__implementation"); } return Helpers.invoke(context, implClass, "new", args, block); } }
@JRubyMethod(name = "new", rest = true) public static IRubyObject rbNew(ThreadContext context, IRubyObject self, IRubyObject[] args, Block block) { Ruby runtime = context.runtime; RubyClass implClass = (RubyClass)self.getInstanceVariables().getInstanceVariable("@__implementation"); if (implClass == null) { implClass = RubyClass.newClass(runtime, (RubyClass)runtime.getClass("InterfaceJavaProxy")); implClass.include(new IRubyObject[] {self}); Helpers.setInstanceVariable(implClass, self, "@__implementation"); } return Helpers.invoke(context, implClass, "new", args, block); } }
@Override public IRubyObject call(ThreadContext context, IRubyObject self, RubyModule clazz, String name, IRubyObject arg) { // TODO: WRONG - get interfaces from class if (arg.respondsTo("java_object")) { IRubyObject interfaces = self.getMetaClass().getInstanceVariables().getInstanceVariable("@java_interfaces"); assert interfaces instanceof RubyArray : "interface list was not an array"; return context.runtime.newBoolean(((RubyArray) interfaces).op_diff( ((JavaClass) ((JavaObject) arg.dataGetStruct()).java_class()).interfaces()).equals(RubyArray.newArray(context.runtime))); } else { return Helpers.invoke(context, self, "old_eqq", arg); } } });