Issue #11151 has been updated by Rafael Frana.


> You probably mean Integer and Float. And possibly also Rational.

Yeah.

For what I could see, probably we'll just need to publish two functions that we are already using internally. https://github.com/ruby/ruby/blob/d77f4934f8ede19d8a97d4bc748c92e9b8883133/numeric.c#L166 and https://github.com/ruby/ruby/blob/d77f4934f8ede19d8a97d4bc748c92e9b8883133/numeric.c#L182



----------------------------------------
Feature #11151: Numeric#positive? and Numeric#negative?
https://bugs.ruby-lang.org/issues/11151#change-52438

* Author: Rafael Frana
* Status: Open
* Priority: Normal
* Assignee: Yukihiro Matsumoto
----------------------------------------
We just added [`Interger#positive?` and `Interger#negative?` to Active Support](https://github.com/rails/rails/commit/e54277a45da3c86fecdfa930663d7692fd083daa).

I was wondering if we could get that implemented in Ruby itself and searched if it was already requested before to Ruby code.

I found that it was requested in #5513, but rejected. Since they were requested with more methods, and I don't know Japanese enough to see if there are technical reasons, I thought to request just these two methods again.

The implementation would be something like:

```
def positive?
  self > 0
end

def negative?
  self < 0
end
```

And one of its use case is filtering, like:

```
bunch_of_numbers.select(&:positive?)
```

If this feature is accepted I can work in a patch.

Related #5513



-- 
https://bugs.ruby-lang.org/