Sha256: 0c64b9db50faafb4a29eded7e05919c803b7ea9c16c676ab9ed11c59dbf52fba
Contents?: true
Size: 772 Bytes
Versions: 1
Compression:
Stored size: 772 Bytes
Contents
module Polyfill module V2_4 module Float module Instance module Truncate module Method def truncate(ndigits = 0) ndigits = ndigits.to_int return super() if ndigits == 0 if ndigits > 0 place = 10 ** ndigits (self * place).truncate / place.to_f else place = 10 ** -ndigits (self.to_f / place).truncate * place end end end if RUBY_VERSION < '2.4.0' refine ::Float do include Method end def self.included(base) base.include Method end end end end end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
polyfill-0.3.0 | lib/polyfill/v2_4/float/instance/truncate.rb |