IronRuby.Builtins.RangeOps.StepObject C# (CSharp) Method

StepObject() private static method

Step through a Range of objects that are not Numeric or String.
private static StepObject ( EachStorage storage, BlockParam block, Range self, object begin, object end, int step ) : object
storage EachStorage
block IronRuby.Runtime.BlockParam
self Range
begin object
end object
step int
return object
        private static object StepObject(EachStorage/*!*/ storage, BlockParam/*!*/ block, Range/*!*/ self, object begin, object end, int step) {
            Assert.NotNull(storage, block, self);
            CheckStep(storage, step);
            CheckBegin(storage, self.Begin);

            object item = begin, result;
            int comp;

            var succSite = storage.SuccSite;
            while ((comp = Protocols.Compare(storage, item, end)) < 0) {
                if (block.Yield(item, out result)) {
                    return result;
                }

                for (int i = 0; i < step; ++i) {
                    item = succSite.Target(succSite, item);
                }
            }

            if (comp == 0 && !self.ExcludeEnd) {
                if (block.Yield(item, out result)) {
                    return result;
                }
            }
            return self;
        }