Sha256: 738bfda0099fe4d0e35f02b9d5794c9dba9c05ec8cbe86e0898c56c36456a9ff

Contents?: true

Size: 522 Bytes

Versions: 1

Compression:

Stored size: 522 Bytes

Contents

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

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

        if RUBY_VERSION < '2.4.0'
          refine ::Integer do
            include Method
          end
        end
      end
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
polyfill-0.2.0 lib/polyfill/v2_4/integer/floor.rb