Skip to content

Commit

Permalink
Float#round support for Rubinius
Browse files Browse the repository at this point in the history
  • Loading branch information
Jeremie Castagna committed Oct 28, 2013
1 parent 3586365 commit cdc34ef
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 0 deletions.
2 changes: 2 additions & 0 deletions Manifest.txt
Expand Up @@ -5,12 +5,14 @@ Rakefile
bin/gin
lib/gin.rb
lib/gin/app.rb
lib/gin/asset_manifest.rb
lib/gin/asset_pipeline.rb
lib/gin/cache.rb
lib/gin/config.rb
lib/gin/constants.rb
lib/gin/controller.rb
lib/gin/core_ext/cgi.rb
lib/gin/core_ext/float.rb
lib/gin/core_ext/gin_class.rb
lib/gin/core_ext/rack_commonlogger.rb
lib/gin/core_ext/time.rb
Expand Down
1 change: 1 addition & 0 deletions lib/gin.rb
Expand Up @@ -125,6 +125,7 @@ def self.app_trace trace

require 'gin/core_ext/cgi'
require 'gin/core_ext/time'
require 'gin/core_ext/float'
require 'gin/core_ext/gin_class'
require 'gin/core_ext/rack_commonlogger'

Expand Down
10 changes: 10 additions & 0 deletions lib/gin/core_ext/float.rb
@@ -0,0 +1,10 @@
if Float.instance_method(:round).arity == 0
class Float
undef round
def round ndigits=0
num, dec = self.to_s.split(".")
num = "#{num}.#{dec[0,ndigits]}".sub(/\.$/, "")
Float num
end
end
end

0 comments on commit cdc34ef

Please sign in to comment.