Class: Bignum

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

Overview

Provides a convenient integration of FizzBuzz with Bignum class.

Instance Method Summary collapse

Instance Method Details

#buzz?Boolean

call-seq:

Bignum.buzz? -> true or false

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

Example:

1000000000000.buzz?   #=> true
1000000000002.buzz?   #=> false
1000000000005.buzz?   #=> false

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


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

def buzz?
  FizzBuzz.is_buzz?(self)
end

#fizz?Boolean

call-seq:

Bignum.fizz? -> true or false

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

Example:

1000000000000.fizz?   #=> false
1000000000002.fizz?   #=> true
1000000000005.fizz?   #=> false

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


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

def fizz?
  FizzBuzz.is_fizz?(self)
end

#fizzbuzz?Boolean

call-seq:

Bignum.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:

1000000000000.fizzbuzz?   #=> false
1000000000002.fizzbuzz?   #=> false
1000000000005.fizzbuzz?   #=> true

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


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

def fizzbuzz?
  FizzBuzz.is_fizzbuzz?(self)
end