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

StepNumeric() private static method

Step through a Range of Numerics.
private static StepNumeric ( StepStorage storage, BlockParam block, Range self, object begin, object end, object step ) : object
storage StepStorage
block IronRuby.Runtime.BlockParam
self Range
begin object
end object
step object
return object
        private static object StepNumeric(StepStorage/*!*/ storage, BlockParam/*!*/ block, Range/*!*/ self, object begin, object end, object step) {
            Assert.NotNull(storage, block, self);
            CheckStep(storage, step);

            object item = begin;
            object result;

            var site = self.ExcludeEnd ? storage.LessThanSite : storage.LessThanEqualsSite;
            while (RubyOps.IsTrue(site.Target(site, item, end))) {
                if (block.Yield(item, out result)) {
                    return result;
                }

                var add = storage.AddSite;
                item = add.Target(add, item, step);
            }

            return self;
        }