summaryrefslogtreecommitdiffhomepage
path: root/mrbgems/mruby-complex
diff options
context:
space:
mode:
Diffstat (limited to 'mrbgems/mruby-complex')
-rw-r--r--mrbgems/mruby-complex/mrblib/complex.rb4
1 files changed, 4 insertions, 0 deletions
diff --git a/mrbgems/mruby-complex/mrblib/complex.rb b/mrbgems/mruby-complex/mrblib/complex.rb
index 67f940865..26a3b206f 100644
--- a/mrbgems/mruby-complex/mrblib/complex.rb
+++ b/mrbgems/mruby-complex/mrblib/complex.rb
@@ -97,6 +97,10 @@ class Complex < Numeric
end
alias_method :rect, :rectangular
+ def to_c
+ self
+ end
+
def to_r
raise RangeError.new "can't convert #{to_s} into Rational" unless imaginary.zero?
Rational(real, 1)