Module: FizzBuzzer::V7::FizzBuzz

Defined in:
lib/fizzbuzzer.rb

Class Method Summary collapse

Class Method Details

.enumeratorObject



221
222
223
224
225
226
227
228
229
230
# File 'lib/fizzbuzzer.rb', line 221

def self.enumerator
  Enumerator::Lazy.new(1..BigDecimal::INFINITY) do |yielder, n|
     yielder << case
                when n % 3 == 0 && n % 5 == 0 then "FizzBuzz"
                when n % 3 == 0               then "Fizz"
                when n % 5 == 0               then "Buzz"
                else n
                end
  end
end