Sha256: 5f89fb7e9b401e4faf67445484ef93c4c49477f6ce35e564556813cebb5d0218

Contents?: true

Size: 147 Bytes

Versions: 23

Compression:

Stored size: 147 Bytes

Contents

class Complex
  def to_r
    raise "Can't convert #{self} into Rational" unless imag.eql?(0)
    real.to_r
  end unless method_defined?(:to_r)
end

Version data entries

23 entries across 23 versions & 2 rubygems

Version Path
backports-3.0.3 lib/backports/1.9.2/complex.rb
backports-3.0.2 lib/backports/1.9.2/complex.rb
backports-3.0.1 lib/backports/1.9.2/complex.rb
backports-3.0.0 lib/backports/1.9.2/complex.rb
backports-2.8.2 lib/backports/1.9.2/complex.rb
backports-2.8.1 lib/backports/1.9.2/complex.rb
backports-2.8.0 lib/backports/1.9.2/complex.rb
backports-2.7.1 lib/backports/1.9.2/complex.rb
backports-2.7.0 lib/backports/1.9.2/complex.rb
backports-2.6.7 lib/backports/1.9.2/complex.rb
backports-2.6.6 lib/backports/1.9.2/complex.rb
backports-2.6.5 lib/backports/1.9.2/complex.rb
fragrant-0.0.5 vendor/bundle/ruby/1.9.1/gems/backports-2.6.4/lib/backports/1.9.2/complex.rb
backports-2.6.4 lib/backports/1.9.2/complex.rb
backports-2.6.3 lib/backports/1.9.2/complex.rb
backports-2.6.2 lib/backports/1.9.2/complex.rb
backports-2.6.1 lib/backports/1.9.2/complex.rb
backports-2.6.0 lib/backports/1.9.2/complex.rb
backports-2.5.3 lib/backports/1.9.2/complex.rb
backports-2.5.2 lib/backports/1.9.2/complex.rb