1 30 package org.jruby.internal.runtime; 31 32 import java.util.ArrayList ; 33 34 import org.jruby.Ruby; 35 import org.jruby.RubyProc; 36 import org.jruby.runtime.IAccessor; 37 38 42 public final class GlobalVariable { 43 private IAccessor accessor; 44 private ArrayList traces = null; 45 private boolean tracing; 46 47 public GlobalVariable(IAccessor accessor) { 48 this.accessor = accessor; 49 } 50 51 public static GlobalVariable newUndefined(Ruby runtime, String name) { 52 GlobalVariable variable = new GlobalVariable(null); 53 variable.setAccessor(new UndefinedAccessor(runtime, variable, name)); 54 return variable; 55 } 56 57 public IAccessor getAccessor() { 58 return accessor; 59 } 60 61 public ArrayList getTraces() { 62 return traces; 63 } 64 65 public void addTrace(RubyProc trace) { 66 if (traces == null) { 67 traces = new ArrayList (); 68 } 69 traces.add(trace); 70 } 71 72 public void setAccessor(IAccessor accessor) { 73 this.accessor = accessor; 74 } 75 public boolean isTracing() { 76 return tracing; 77 } 78 79 } 80 | Popular Tags |