diff options
author | Jeremy Evans <code@jeremyevans.net> | 2019-06-04 21:41:02 -0700 |
---|---|---|
committer | Jeremy Evans <code@jeremyevans.net> | 2019-06-19 10:50:58 -0700 |
commit | b9ef35e4c6325864e013ab6e45df6fe00f759a47 (patch) | |
tree | 0e3814c316dd16034139a4b2802a69aca469da7c /NEWS | |
parent | 65944e96d39a8ae3602751f49cb337335b2c6c45 (diff) | |
download | ruby-b9ef35e4c6325864e013ab6e45df6fe00f759a47.tar.gz |
Implement Complex#<=>
Implement Complex#<=> so that it is usable as an argument when
calling <=> on objects of other classes (since #coerce will coerce
such numbers to Complex). If the complex number has a zero imaginary
part, and the other argument is a real number (or complex number with
zero imaginary part), return -1, 0, or 1. Otherwise, return nil,
indicating the objects are not comparable.
Fixes [Bug #15857]
Diffstat (limited to 'NEWS')
-rw-r--r-- | NEWS | 7 |
1 files changed, 7 insertions, 0 deletions
@@ -62,6 +62,13 @@ sufficient information, see the ChangeLog file or Redmine === Core classes updates (outstanding ones only) +Complex:: + + New method:: + + * Added Complex#<=>. So 0 <=> 0i will not raise NoMethodError. + [Bug #15857] + Enumerable:: New method:: |