#FEATURE by cg
authorClaus Gittinger <cg@exept.de>
Thu, 15 Jun 2017 13:57:20 +0200
changeset 21819 c62073747a0a
parent 21818 20bc6feedae5
child 21820 3825bcd2e2c7
#FEATURE by cg class: Fraction class added: #coerce:
Fraction.st
--- a/Fraction.st	Thu Jun 15 13:57:09 2017 +0200
+++ b/Fraction.st	Thu Jun 15 13:57:20 2017 +0200
@@ -237,6 +237,14 @@
     ]
 ! !
 
+!Fraction class methodsFor:'coercing & converting'!
+
+coerce:aNumber
+    "convert the argument aNumber into an instance of the receiver's class and return it."
+
+    ^ aNumber asFraction
+! !
+
 !Fraction class methodsFor:'constants'!
 
 pi