lib/multiples/multiples_enumerator.rb in multiples-0.1.1 vs lib/multiples/multiples_enumerator.rb in multiples-0.1.2
- old
+ new
@@ -4,10 +4,10 @@
def new a, b
@a, @b = (a..Float::INFINITY).step(a), (b..Float::INFINITY).step(b)
@palindrome_length = a + b - 1
@stack = [[@a.peek, @b.peek].min.to_i]
send :build_palindrome
- return MultiplesEnumerator.new(@stack)
+ return MultiplesEnumerator.new(@stack.reject(&:zero?))
end
private
def build_palindrome
until @stack.length == @palindrome_length