Module: FizzBuzzer::V6b::FizzBuzz

Defined in:
lib/fizzbuzzer.rb

Class Method Summary collapse

Class Method Details

.enumeratorObject



188
189
190
191
192
193
194
195
196
197
198
# File 'lib/fizzbuzzer.rb', line 188

def self.enumerator
  Enumerator.new do |yielder|
    (1..100).each do |n|
      yielder << if    n % 3 == 0 && n % 5 == 0 then "FizzBuzz"
                 elsif n % 3 == 0               then "Fizz"
                 elsif n % 5 == 0               then "Buzz"
                 else  n
                 end
    end
  end
end