The objective of this exercise is to explore programming concepts from Ruby Steps, lectures 1 to 10.
##Fizz Buzz Requirements
For the numbers from 1 to 100:
- If the number is a multiple of 3, print fuzz
- If the number is a multiple of 5, print buzz
- If the number is a multiple of 3 and 5, print fizz buzz
- Otherwise, print the number
- Write some tests with rspec
- Create a FizzBuzz class
- Create a method that maintains an instance variable of the same name
The Class
The Test
- Refactor to evaluate fizz buzz with blocks
- Write a method that contains a hash with a proc value [:evaluation] and a string value [:return_result]
- Refactor tests to evaluate method-hash-proc-string structure
Class Refactor
Test Refactor
- DRY: call blocks with common evaluator
- No test refactor needed!
Class Refactor