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