public static Hash /*!*/ Initialize(Hash /*!*/ self) { Assert.NotNull(self); return(self); }
public static Hash /*!*/ CreateSubclass(RubyClass /*!*/ self) { return(Hash.CreateInstance(self)); }
public static Hash /*!*/ CreateSubclass(RubyClass /*!*/ self, [NotNull] IDictionary <object, object> /*!*/ hash) { // creates a new hash and copies entries of the given hash into it (no other objects associated with the has are copied): return(IDictionaryOps.ReplaceData(Hash.CreateInstance(self), hash)); }
public static Proc GetDefaultProc(Hash /*!*/ self) { return(self.DefaultProc); }
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 object SetDefaultValue(RubyContext /*!*/ context, Hash /*!*/ self, object value) { self.Mutate(); self.DefaultProc = null; return(self.DefaultValue = value); }
public static object GetDefaultValue(CallSiteStorage <Func <CallSite, Proc, Hash, object, object> > /*!*/ storage, Hash /*!*/ self, object key) { if (self.DefaultProc != null) { var site = storage.GetCallSite("call", 2); return(site.Target(site, self.DefaultProc, self, key)); } return(self.DefaultValue); }
public static object GetDefaultValue(RubyContext /*!*/ context, Hash /*!*/ self) { return(self.DefaultValue); }
public static object GetElement(CallSiteStorage <Func <CallSite, Hash, object, object> > /*!*/ storage, Hash /*!*/ self, object key) { object result; if (!self.TryGetValue(CustomStringDictionary.NullToObj(key), out result)) { var site = storage.GetCallSite("default", 1); return(site.Target(site, self, key)); } return(result); }
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); }