Sha256: 96c02cd0e69dda33ba6f80ed7fc21c5ce836266a224c1f512966b4c146e9bf28

Contents?: true

Size: 467 Bytes

Versions: 1

Compression:

Stored size: 467 Bytes

Contents

module Polyfill
  module V2_4
    module Integer
      module Ceil
        module Method
          def ceil(ndigits = 0)
            ndigits = ndigits.to_int
            return super() if ndigits == 0
            return to_f if ndigits > 0

            place = 10 ** -ndigits
            (self.to_f / place).ceil * place
          end if RUBY_VERSION < '2.4.0'
        end

        refine ::Integer do
          include Method
        end
      end
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
polyfill-0.1.0 lib/polyfill/v2_4/integer/ceil.rb