mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05:00
* exception message clean-up by Ian Macdonald <ian@caliban.org>.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@6044 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
parent
6a738f2265
commit
919f456de8
39 changed files with 127 additions and 124 deletions
|
@ -48,7 +48,7 @@ class Rational < Numeric
|
|||
@RCS_ID='-$Id: rational.rb,v 1.7 1999/08/24 12:49:28 keiju Exp keiju $-'
|
||||
|
||||
def Rational.reduce(num, den = 1)
|
||||
raise ZeroDivisionError, "denominator is 0" if den == 0
|
||||
raise ZeroDivisionError, "denominator is zero" if den == 0
|
||||
|
||||
if den < 0
|
||||
num = -num
|
||||
|
@ -135,7 +135,7 @@ class Rational < Numeric
|
|||
den = @denominator * a.numerator
|
||||
Rational(num, den)
|
||||
elsif a.kind_of?(Integer)
|
||||
raise ZeroDivisionError, "divided by 0" if a == 0
|
||||
raise ZeroDivisionError, "division by zero" if a == 0
|
||||
self / Rational.new!(a, 1)
|
||||
elsif a.kind_of?(Float)
|
||||
Float(self) / a
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue