Class: FizzBuzz
- Inherits:
-
Object
- Object
- FizzBuzz
- Defined in:
- lib/fizz_buzz.rb
Constant Summary collapse
- DEFINITIONS =
{'3' => 'fizz', '5' => 'buzz'}
Instance Attribute Summary collapse
-
#number ⇒ Object
Returns the value of attribute number.
Instance Method Summary collapse
-
#initialize(number) ⇒ FizzBuzz
constructor
A new instance of FizzBuzz.
- #to_s ⇒ Object
- #valid? ⇒ Boolean
Constructor Details
#initialize(number) ⇒ FizzBuzz
Returns a new instance of FizzBuzz.
5 6 7 |
# File 'lib/fizz_buzz.rb', line 5 def initialize(number) @number = number end |
Instance Attribute Details
#number ⇒ Object
Returns the value of attribute number.
3 4 5 |
# File 'lib/fizz_buzz.rb', line 3 def number @number end |
Instance Method Details
#to_s ⇒ Object
13 14 15 |
# File 'lib/fizz_buzz.rb', line 13 def to_s convert if valid? end |
#valid? ⇒ Boolean
9 10 11 |
# File 'lib/fizz_buzz.rb', line 9 def valid? number > 0 end |