lib/job-iteration/enumerator_builder.rb in job-iteration-1.3.5 vs lib/job-iteration/enumerator_builder.rb in job-iteration-1.3.6
- old
+ new
@@ -41,10 +41,11 @@
end
# Builds Enumerator objects that iterates N times and yields number starting from zero.
def build_times_enumerator(number, cursor:)
raise ArgumentError, "First argument must be an Integer" unless number.is_a?(Integer)
+
wrap(self, build_array_enumerator(number.times.to_a, cursor: cursor))
end
# Builds Enumerator object from a given array, using +cursor+ as an offset.
def build_array_enumerator(enumerable, cursor:)
@@ -52,9 +53,10 @@
raise ArgumentError, "enumerable must be an Array"
end
if enumerable.any? { |i| defined?(ActiveRecord) && i.is_a?(ActiveRecord::Base) }
raise ArgumentError, "array cannot contain ActiveRecord objects"
end
+
drop =
if cursor.nil?
0
else
cursor + 1