public static IRubyObject instVarNullToNil(IRubyObject value, IRubyObject nil, String name) { if (value == null) { Ruby runtime = nil.getRuntime(); if (runtime.isVerbose()) { nil.getRuntime() .getWarnings() .warning( IRubyWarnings.ID.IVAR_NOT_INITIALIZED, "instance variable " + name + " not initialized"); } return nil; } return value; }
public final IRubyObject getVariable(Ruby runtime, int index, String name, IRubyObject object) { VariableAccessor variableAccessor = variableReaders[index]; RubyClass cls = object.getMetaClass().getRealClass(); if (variableAccessor.getClassId() != cls.hashCode()) { variableReaders[index] = variableAccessor = cls.getVariableAccessorForRead(name); } IRubyObject value = (IRubyObject) variableAccessor.get(object); if (value != null) { return value; } if (runtime.isVerbose()) { warnAboutUninitializedIvar(runtime, name); } return runtime.getNil(); }