Exemplo n.º 1
0
        public static Hash /*!*/ Replace(RubyContext /*!*/ context, Hash /*!*/ self, [DefaultProtocol, NotNull] IDictionary <object, object> /*!*/ other)
        {
            if (Object.ReferenceEquals(self, other))
            {
                self.RequireNotFrozen();
                return(self);
            }

            Hash otherHash = other as Hash;

            if (otherHash != null)
            {
                self.DefaultValue = otherHash.DefaultValue;
                self.DefaultProc  = otherHash.DefaultProc;
            }
            return(IDictionaryOps.ReplaceData(self, other));
        }
Exemplo n.º 2
0
        public static object Shift(CallSiteStorage <Func <CallSite, Hash, object, object> > /*!*/ storage, Hash /*!*/ self)
        {
            self.RequireNotFrozen();

            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));
        }
Exemplo n.º 3
0
 public static Hash /*!*/ CompareByIdentity(Hash /*!*/ self)
 {
     self.RequireNotFrozen();
     self.SetComparer(ReferenceEqualityComparer <object> .Instance);
     return(self);
 }
Exemplo n.º 4
0
 public static Hash /*!*/ Initialize(Hash /*!*/ self)
 {
     Assert.NotNull(self);
     self.RequireNotFrozen();
     return(self);
 }
Exemplo n.º 5
0
 public static object Shift(Hash /*!*/ self)
 {
     self.RequireNotFrozen();
     return(Shift((IDictionary <object, object>)self));
 }
Exemplo n.º 6
0
 public static object RejectMutate([NotNull] BlockParam /*!*/ block, Hash /*!*/ self)
 {
     self.RequireNotFrozen();
     return(RejectMutate(block, (IDictionary <object, object>)self));
 }
Exemplo n.º 7
0
 public static Hash /*!*/ Replace(RubyContext /*!*/ context, Hash /*!*/ self, [DefaultProtocol, NotNull] IDictionary <object, object> /*!*/ other)
 {
     self.RequireNotFrozen();
     return(IDictionaryOps.ReplaceData(self, other));
 }
Exemplo n.º 8
0
 public static IDictionary <object, object> Rehash(Hash /*!*/ self)
 {
     self.RequireNotFrozen();
     return(Rehash((IDictionary <object, object>)self));
 }
Exemplo n.º 9
0
 public static object Update(BlockParam block, Hash /*!*/ self, [DefaultProtocol, NotNull] IDictionary <object, object> /*!*/ hash)
 {
     self.RequireNotFrozen();
     return(Update(block, (IDictionary <object, object>)self, hash));
 }
Exemplo n.º 10
0
 public static object Delete(BlockParam block, Hash /*!*/ self, object key)
 {
     self.RequireNotFrozen();
     return(Delete(block, (IDictionary <object, object>)self, key));
 }
Exemplo n.º 11
0
 public static IDictionary <object, object> /*!*/ Clear(Hash /*!*/ self)
 {
     self.RequireNotFrozen();
     self.Clear();
     return(self);
 }
Exemplo n.º 12
0
 public static object SetElement(RubyContext /*!*/ context, Hash /*!*/ self, object key, object value)
 {
     self.RequireNotFrozen();
     return(RubyUtils.SetHashElement(context, self, key, value));
 }