Module: FizzBuzzer::V7::FizzBuzz
- Defined in:
- lib/fizzbuzzer.rb
Class Method Summary collapse
Class Method Details
.enumerator ⇒ Object
218 219 220 221 222 223 224 225 226 227 |
# File 'lib/fizzbuzzer.rb', line 218 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 |