summaryrefslogtreecommitdiff
path: root/lib/complex.rb
diff options
context:
space:
mode:
Diffstat (limited to 'lib/complex.rb')
-rw-r--r--lib/complex.rb6
1 files changed, 6 insertions, 0 deletions
diff --git a/lib/complex.rb b/lib/complex.rb
index 0e88dd5..1845f30 100644
--- a/lib/complex.rb
+++ b/lib/complex.rb
@@ -2,3 +2,9 @@ require 'cmath'
Object.instance_eval{remove_const :Math}
Math = CMath
+
+def Complex.generic? (other)
+ other.kind_of?(Integer) ||
+ other.kind_of?(Float) ||
+ other.kind_of?(Rational)
+end