#--
# Credit goes to George Moschovitis
#++

class Numeric

  # Returns the multiple ceil of a number.
  def ceil_multiple(multiple)
    # gmosx: to_f is needed!
    # gmosx: IS THERE a more optimized way to do this?
    return ((self.to_f/multiple).ceil*multiple)
  end

end


#  _____         _
# |_   _|__  ___| |_
#   | |/ _ \/ __| __|
#   | |  __/\__ \ |_
#   |_|\___||___/\__|
#
=begin test

  require 'test/unit'

  class TCNumeric < Test::Unit::TestCase

    def test_ceil_multiple
      assert_equal( 12.3, 12.3.ceil_multiple(0.1) )
      assert_equal( 12.4, 12.31.ceil_multiple(0.1) )
      assert_equal( 13, 12.3.ceil_multiple(1) )
      assert_equal( 13, 12.31.ceil_multiple(1) )
      assert_equal( 20, 12.3.ceil_multiple(10) )
      assert_equal( 20, 12.31.ceil_multiple(10) )
    end

  end

=end
