IronRuby.Builtins.HashOps.Shift C# (CSharp) Method

Shift() private method

private Shift ( CallSiteStorage storage, Hash self ) : object
storage CallSiteStorage
self Hash
return object
        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);
        }