class Complex

Public Class Methods

try_convert(obj) click to toggle source

Try to convert obj into an Complex, using Kernel::Complex method. Returns converted Complex or nil if obj cannot be converted for any reason.

# File lib/try_convert.rb, line 34
def Complex.try_convert obj
  Complex(obj) rescue nil
end