Class: Integer
- Inherits:
-
Object
- Object
- Integer
- Defined in:
- lib/ext/core/integer.rb
Instance Method Summary collapse
Instance Method Details
#closest_fibonacci ⇒ Object
3 4 5 6 7 8 9 10 11 |
# File 'lib/ext/core/integer.rb', line 3 def closest_fibonacci raise InvalidArgumentError.new("Cannot be less than zero") if self < 0 return self if [0,1].include?(self) x, y = 1, 1 while((x+y) < self) do x, y = (x+y), x end x end |