public void replaceLinkWith(IRubyObject newObject) { obj.getInstanceVariables().setInstanceVariable(ivarName, newObject); } }
public static IRubyObject getInstanceVariableNoWarn(IRubyObject self, ThreadContext context, String internedName) { IRubyObject result = self.getInstanceVariables().getInstanceVariable(internedName); if (result != null) return result; return context.nil; }
/** inspect_obj * * The internal helper method that takes care of the part of the * inspection that inspects instance variables. */ private static StringBuilder inspectObj(IRubyObject self, StringBuilder part) { ThreadContext context = getRuntime(self).getCurrentContext(); String sep = ""; for (Variable<IRubyObject> ivar : getInstanceVariables(self).getInstanceVariableList()) { part.append(sep).append(' ').append(ivar.getName()).append('='); part.append(invokedynamic(context, ivar.getValue(), INSPECT)); sep = ","; } part.append('>'); return part; }
private static boolean initInterfaceModules(final IRubyObject self, final IRubyObject module) { if ( ! module.getInstanceVariables().hasInstanceVariable("@java_interface_mods") ) { final RubyArray interfaceMods = RubyArray.newArray(self.getRuntime(), self); module.getInstanceVariables().setInstanceVariable("@java_interface_mods", interfaceMods); return true; } return false; }
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); }
static void updateInstanceVar(final RubyObject receiver, final BiVariableMap vars) { InstanceVariables ivars = receiver.getInstanceVariables(); List<String> keys = ivars.getInstanceVariableNameList(); for (String key : keys) { IRubyObject value = ivars.getInstanceVariable(key); BiVariable var = vars.getVariable(receiver, key); if (var != null) { var.setRubyObject(value); } else { var = new InstanceVariable(receiver, key, value); vars.update(key, var); } } }
if (module.getInstanceVariables().hasInstanceVariable("@java_class") && module.getInstanceVariables().getInstanceVariable("@java_class").isTrue()) { throw runtime.newTypeError("can not add Java interface to existing Java interface"); if (!module.getInstanceVariables().hasInstanceVariable("@java_interface_mods")) { RubyArray javaInterfaceMods = RubyArray.newArray(runtime, self); module.getInstanceVariables().setInstanceVariable("@java_interface_mods", javaInterfaceMods); RubyClass singleton = module.getSingletonClass(); } else { RubyArray javaInterfaceMods =(RubyArray)module.getInstanceVariables().getInstanceVariable("@java_interface_mods"); if (!javaInterfaceMods.includes(context, self)) { javaInterfaceMods.append(self);
if (!ancestor.getInstanceVariables().hasInstanceVariable("@java_proxy_class")) { skipRemainingClasses = true; continue; IRubyObject var = ancestor.getInstanceVariables().getInstanceVariable("@java_class"); if ( ! (var instanceof JavaClass) ) { if (var == null) { var = ancestor.getInstanceVariables().getInstanceVariable("@java_interfaces"); if (var != null && !(var instanceof RubyNil)) { if (!(var instanceof RubyArray)) {
@JIT @Interp public static IRubyObject isDefinedInstanceVar(ThreadContext context, IRubyObject receiver, String name, IRubyObject definedMessage) { return receiver.getInstanceVariables().hasInstanceVariable(name) ? definedMessage : context.nil; }
ivarHolder.getInstanceVariables().copyInstanceVariablesInto(regexp);
static void updateInstanceVar(final RubyObject receiver, final BiVariableMap vars) { InstanceVariables ivars = receiver.getInstanceVariables(); List<String> keys = ivars.getInstanceVariableNameList(); for (String key : keys) { IRubyObject value = ivars.getInstanceVariable(key); BiVariable var = vars.getVariable(receiver, key); if (var != null) { var.setRubyObject(value); } else { var = new InstanceVariable(receiver, key, value); vars.update(key, var); } } }
if (module.getInstanceVariables().hasInstanceVariable("@java_class") && module.getInstanceVariables().getInstanceVariable("@java_class").isTrue()) { throw runtime.newTypeError("can not add Java interface to existing Java interface"); if (!module.getInstanceVariables().hasInstanceVariable("@java_interface_mods")) { RubyArray javaInterfaceMods = RubyArray.newArray(runtime, self); module.getInstanceVariables().setInstanceVariable("@java_interface_mods", javaInterfaceMods); RubyClass singleton = module.getSingletonClass(); } else { RubyArray javaInterfaceMods =(RubyArray)module.getInstanceVariables().getInstanceVariable("@java_interface_mods"); if (!javaInterfaceMods.includes(context, self)) { javaInterfaceMods.append(self);
if (!ancestor.getInstanceVariables().hasInstanceVariable("@java_proxy_class")) { skipRemainingClasses = true; continue; IRubyObject var = ancestor.getInstanceVariables().getInstanceVariable("@java_class"); if ( ! (var instanceof JavaClass) ) { if (var == null) { var = ancestor.getInstanceVariables().getInstanceVariable("@java_interfaces"); if (var != null && !(var instanceof RubyNil)) { if (!(var instanceof RubyArray)) {
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); }
private static boolean initInterfaceModules(final IRubyObject self, final IRubyObject module) { if ( ! module.getInstanceVariables().hasInstanceVariable("@java_interface_mods") ) { final RubyArray interfaceMods = RubyArray.newArray(self.getRuntime(), self); module.getInstanceVariables().setInstanceVariable("@java_interface_mods", interfaceMods); return true; } return false; }
@JIT @Interp public static IRubyObject isDefinedInstanceVar(ThreadContext context, IRubyObject receiver, String name, IRubyObject definedMessage) { return receiver.getInstanceVariables().hasInstanceVariable(name) ? definedMessage : context.nil; }
ivarHolder.getInstanceVariables().copyInstanceVariablesInto(regexp);
public IRubyObject setInstanceVariable(IRubyObject obj, String variableName, IRubyObject value) { return obj.getInstanceVariables().setInstanceVariable(variableName, value); }
public static IRubyObject getInstanceVariableNoWarn(IRubyObject self, ThreadContext context, String internedName) { IRubyObject result = self.getInstanceVariables().getInstanceVariable(internedName); if (result != null) return result; return context.nil; }
static void updateInstanceVar(RubyObject receiver, BiVariableMap vars) { InstanceVariables ivars = receiver.getInstanceVariables(); List<String> keys = ivars.getInstanceVariableNameList(); for (String key : keys) { IRubyObject value = ivars.getInstanceVariable(key); BiVariable var = vars.getVariable(receiver, key); if (var != null) { var.setRubyObject(value); } else { var = new InstanceVariable(receiver, key, value); vars.update(key, var); } } }