add Integer#div and Float#div.

This commit is contained in:
Tomoyuki Sahara
2014-03-04 12:45:11 +09:00
parent 6b6277e2c6
commit 4ad0896bda
2 changed files with 13 additions and 0 deletions
@@ -0,0 +1,5 @@
module Integral
def div(other)
self.divmod(other)[0]
end
end
@@ -13,3 +13,11 @@ assert('Integer#chr') do
assert_raise(RangeError) { 256.chr }
end
end
assert('Integer#div') do
assert_equal 52, 365.div(7)
end
assert('Float#div') do
assert_float 52, 365.2425.div(7)
end