Sha256: 914b8b2b4a275539acac526c5b6919bf3cd16d7caf0d091876e7e121044be95b
Contents?: true
Size: 1.15 KB
Versions: 12
Compression:
Stored size: 1.15 KB
Contents
package org.cx4a.rsense.ruby; public class DynamicScope extends LocalScope { private Scope scope; private int snapshot; public DynamicScope(RubyModule cref, Scope scope) { super(cref); this.scope = scope; this.snapshot = scope.hashCode(); } @Override public IRubyObject getValue(String name) { IRubyObject value = super.getValue(name); return value != null ? value : scope.getValue(name); } @Override public void setValue(String name, IRubyObject value) { if (scope.getValue(name) != null) { scope.setValue(name, value); } else { super.setValue(name, value); } } @Override public int hashCode() { return snapshot; } @Override public boolean equals(Object other) { if (this == other) { return true; } if (!(other instanceof DynamicScope)) { return false; } DynamicScope o = (DynamicScope) other; return snapshot == o.snapshot; } @Override public String toString() { return "<DynScope: " + scope.toString() + ">"; } }
Version data entries
12 entries across 12 versions & 1 rubygems