public static Hash /*!*/ InitializeCopy(RubyContext /*!*/ context, Hash /*!*/ self, [NotNull] Hash /*!*/ source) { self.Mutate(); self.DefaultProc = source.DefaultProc; self.DefaultValue = source.DefaultValue; IDictionaryOps.ReplaceData(self, source); return(self); }
public static Hash /*!*/ Replace(RubyContext /*!*/ context, Hash /*!*/ self, [DefaultProtocol, NotNull] IDictionary <object, object> /*!*/ other) { if (Object.ReferenceEquals(self, other)) { return(self); } self.Mutate(); Hash otherHash = other as Hash; if (otherHash != null) { self.DefaultValue = otherHash.DefaultValue; self.DefaultProc = otherHash.DefaultProc; } return(IDictionaryOps.ReplaceData(self, other)); }
public static object Shift(CallSiteStorage <Func <CallSite, Hash, object, object> > /*!*/ storage, Hash /*!*/ self) { self.Mutate(); if (self.Count == 0) { var site = storage.GetCallSite("default", 1); return(site.Target(site, self, null)); } IEnumerator <KeyValuePair <object, object> > e = self.GetEnumerator(); e.MoveNext(); KeyValuePair <object, object> pair = e.Current; self.Remove(pair.Key); return(IDictionaryOps.MakeArray(pair)); }
public static Hash /*!*/ Replace(RubyContext /*!*/ context, Hash /*!*/ self, [DefaultProtocol, NotNull] IDictionary <object, object> /*!*/ other) { self.Mutate(); return(IDictionaryOps.ReplaceData(self, other)); }
public static object SetDefaultValue(RubyContext /*!*/ context, Hash /*!*/ self, object value) { self.Mutate(); self.DefaultProc = null; return(self.DefaultValue = value); }