Browse files

Added Class

  • Loading branch information...
1 parent 15d4fb9 commit 6652176dbfeac77ce313a681a96131debb07551e Victor Velazquez committed Oct 12, 2011
Showing with 11 additions and 9 deletions.
  1. +11 −9 fibo.rb
View
20 fibo.rb
@@ -1,12 +1,14 @@
-def closest_fibonacci
- a,b = 0,1
- begin
- self.times do
- a,b = b,a+b
- if(b>=self)
- puts "#{a}"
- break
+class Fixnum
+ def closest_fibonacci
+ a,b = 0,1
+ begin
+ self.times do
+ a,b = b,a+b
+ if(b>=self)
+ puts "#{a}"
+ break
+ end
end
- end
+ end
end
end

0 comments on commit 6652176

Please sign in to comment.