Class: Integer

Inherits:
Object
  • Object
show all
Defined in:
lib/fizzbuzz/core/integer.rb

Overview

Provides a convenient integration of FizzBuzz with Integer class.

Instance Method Summary collapse

Instance Method Details

#buzz?Boolean

call-seq:

Integer.buzz? -> true or false

Returns true if a given integer value is divisible by five (given value is a Buzz), or false otherwise.

Example:

 3.buzz?   #=> false
 5.buzz?   #=> true
15.buzz?   #=> false

See also: FizzBuzz::[] and FizzBuzz::is_buzz?

Returns:

  • (Boolean)

63
64
65
# File 'lib/fizzbuzz/core/integer.rb', line 63

def buzz?
  FizzBuzz.is_buzz?(self)
end

#fizz?Boolean

call-seq:

Integer.fizz? -> true or false

Returns true if a given integer value is divisible by three (given value is a Fizz), or false otherwise.

Example:

 3.fizz?   #=> true
 5.fizz?   #=> false
15.fizz?   #=> false

See also: FizzBuzz::[] and FizzBuzz::is_fizz?

Returns:

  • (Boolean)

44
45
46
# File 'lib/fizzbuzz/core/integer.rb', line 44

def fizz?
  FizzBuzz.is_fizz?(self)
end

#fizzbuzz?Boolean

call-seq:

Integer.fizzbuzz? -> true or false

Returns true if a given integer value is divisible by both three and five (given value is a FizzBuzz), or false otherwise.

Example:

 3.fizzbuzz?   #=> false
 5.fizzbuzz?   #=> false
15.fizzbuzz?   #=> true

See also: FizzBuzz::[] and FizzBuzz::is_fizzbuzz?

Returns:

  • (Boolean)

82
83
84
# File 'lib/fizzbuzz/core/integer.rb', line 82

def fizzbuzz?
  FizzBuzz.is_fizzbuzz?(self)
end