diff options
author | Rafael Mendonça França <rafaelmfranca@gmail.com> | 2015-05-19 01:25:00 -0300 |
---|---|---|
committer | Rafael Mendonça França <rafaelmfranca@gmail.com> | 2015-05-19 01:25:00 -0300 |
commit | 6c55cffa5bb804fc0291ec4aa82527ec3c57f2d2 (patch) | |
tree | 687765a6566533f1e5a538ad9177afe7530784c6 /activesupport/lib/active_support/core_ext/numeric/inquiry.rb | |
parent | 72959da5edfec80b85b28aedb880ed89e9dd77d4 (diff) | |
download | rails-6c55cffa5bb804fc0291ec4aa82527ec3c57f2d2.tar.gz rails-6c55cffa5bb804fc0291ec4aa82527ec3c57f2d2.tar.bz2 rails-6c55cffa5bb804fc0291ec4aa82527ec3c57f2d2.zip |
Only define #positive? and #negative? on Ruby 2.2
The feature was accepted and added to Ruby 2.3+ so we don't need to
define it again.
See https://bugs.ruby-lang.org/issues/11151
Diffstat (limited to 'activesupport/lib/active_support/core_ext/numeric/inquiry.rb')
-rw-r--r-- | activesupport/lib/active_support/core_ext/numeric/inquiry.rb | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/activesupport/lib/active_support/core_ext/numeric/inquiry.rb b/activesupport/lib/active_support/core_ext/numeric/inquiry.rb index b1a27dd698..7e7ac1b0b2 100644 --- a/activesupport/lib/active_support/core_ext/numeric/inquiry.rb +++ b/activesupport/lib/active_support/core_ext/numeric/inquiry.rb @@ -1,3 +1,4 @@ +unless 1.respond_to?(:positive?) # TODO: Remove this file when we drop support to ruby < 2.3 class Numeric # Returns true if the number is positive. # @@ -17,3 +18,9 @@ class Numeric self < 0 end end + +class Complex + undef :positive? + undef :negative? +end +end |