public override bool Equals(object o) { if (this == o) { return(true); } if (o is RHash == false) { return(false); } RHash ot = (RHash)o; Hashtable oh = ot.hash; if (hash.Count != oh.Count) { return(false); } lock (hash.SyncRoot) { foreach (DictionaryEntry ent in hash) { if (oh.ContainsKey(ent.Key) == false) { return(false); } if (oh[ent.Key].Equals(ent.Value) == false) { return(false); } } } return(true); }
static internal object s_create(RBasic r, params object[] args) { RHash hash; if (args.Length == 1 && args[0] is RHash) { hash = new RHash(r.ruby, ((RHash)args[0]), (RMetaObject)r); return(hash); } if (args.Length % 2 != 0) { throw new eArgError("odd number args for Hash"); } hash = new RHash(r.ruby, (RMetaObject)r); for (int i = 0; i < args.Length; i += 2) { hash[args[i]] = args[i + 1]; } return(hash); }
public RHash(NetRuby rb, RHash org, RMetaObject meta) : base(rb, meta) { hash = (Hashtable)org.hash.Clone(); ifnone = null; }
static internal object s_create(RBasic r, params object[] args) { RHash hash; if (args.Length == 1 && args[0] is RHash) { hash = new RHash(r.ruby, ((RHash)args[0]), (RMetaObject)r); return hash; } if (args.Length % 2 != 0) { throw new eArgError("odd number args for Hash"); } hash = new RHash(r.ruby, (RMetaObject)r); for (int i = 0; i < args.Length; i += 2) { hash[args[i]] = args[i + 1]; } return hash; }
static internal object s_new(RBasic r, params object[] args) { RHash hash = new RHash(r.ruby, (RMetaObject)r); r.ruby.CallInit(hash, args); return hash; }
static internal object aref(RBasic r, params object[] args) { RHash h = (RHash)r; return(h[args[0]]); }