Class: Integer

Inherits:
Object
  • Object
show all
Defined in:
lib/cs_fibonacci.rb

Overview

Integer mixin providing Integer.fibonacci() instance method that delegates to CS::fibonacci. Type the following:

require 'cs' # get the gem require 'cs_fibonacci.rb' # get the Integer mixin

And now you can do this:

<code>

puts 7.fibonacci() # prints 8

</code>

Instance Method Summary collapse

Instance Method Details

#fibonacci(algorithm = CS::MATRIX) ⇒ Object



18
19
20
# File 'lib/cs_fibonacci.rb', line 18

def fibonacci algorithm = CS::MATRIX
  return CS::fibonacci(self, algorithm)
end