Sha256: bb1e29f82eae73deb11753899b12d6f14485595d4b11a9cea5d33a46e352cbe4

Contents?: true

Size: 425 Bytes

Versions: 16

Compression:

Stored size: 425 Bytes

Contents

module MoreCoreExtensions
  module NumericRounding
    def round_up(nearest = 1)
      return self if nearest == 0
      return self if (self % nearest) == 0
      self + nearest - (self % nearest)
    end

    def round_down(nearest = 1)
      return self if nearest == 0
      return self if (self % nearest) == 0
      self - (self % nearest)
    end
  end
end

Numeric.send(:prepend, MoreCoreExtensions::NumericRounding)

Version data entries

16 entries across 16 versions & 1 rubygems

Version Path
more_core_extensions-4.5.0 lib/more_core_extensions/core_ext/numeric/rounding.rb
more_core_extensions-4.4.0 lib/more_core_extensions/core_ext/numeric/rounding.rb
more_core_extensions-4.3.1 lib/more_core_extensions/core_ext/numeric/rounding.rb
more_core_extensions-4.3.0 lib/more_core_extensions/core_ext/numeric/rounding.rb
more_core_extensions-4.2.0 lib/more_core_extensions/core_ext/numeric/rounding.rb
more_core_extensions-4.1.0 lib/more_core_extensions/core_ext/numeric/rounding.rb
more_core_extensions-4.0.0 lib/more_core_extensions/core_ext/numeric/rounding.rb
more_core_extensions-3.8.0 lib/more_core_extensions/core_ext/numeric/rounding.rb
more_core_extensions-3.7.0 lib/more_core_extensions/core_ext/numeric/rounding.rb
more_core_extensions-3.6.0 lib/more_core_extensions/core_ext/numeric/rounding.rb
more_core_extensions-3.5.0 lib/more_core_extensions/core_ext/numeric/rounding.rb
more_core_extensions-3.4.0 lib/more_core_extensions/core_ext/numeric/rounding.rb
more_core_extensions-3.3.0 lib/more_core_extensions/core_ext/numeric/rounding.rb
more_core_extensions-3.2.0 lib/more_core_extensions/core_ext/numeric/rounding.rb
more_core_extensions-3.1.1 lib/more_core_extensions/core_ext/numeric/rounding.rb
more_core_extensions-3.1.0 lib/more_core_extensions/core_ext/numeric/rounding.rb