Sha256: e4374e8c50ab5d6faae3bee4c6e29a1908556fd8abb37dcf560f2f7186fcd462

Contents?: true

Size: 592 Bytes

Versions: 49

Compression:

Stored size: 592 Bytes

Contents

# frozen_string_literal: true

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.
    #
    #   1.positive?  # => true
    #   0.positive?  # => false
    #   -1.positive? # => false
    def positive?
      self > 0
    end

    # Returns true if the number is negative.
    #
    #   -1.negative? # => true
    #   0.negative?  # => false
    #   1.negative?  # => false
    def negative?
      self < 0
    end
  end

  class Complex
    undef :positive?
    undef :negative?
  end
end

Version data entries

49 entries across 49 versions & 8 rubygems

Version Path
activesupport-5.2.1 lib/active_support/core_ext/numeric/inquiry.rb
activesupport-5.2.1.rc1 lib/active_support/core_ext/numeric/inquiry.rb
monero_wallet_gen-0.1.0 vendor/bundle/ruby/2.3.0/gems/activesupport-5.2.0/lib/active_support/core_ext/numeric/inquiry.rb
activesupport-5.2.0 lib/active_support/core_ext/numeric/inquiry.rb
activesupport-5.2.0.rc2 lib/active_support/core_ext/numeric/inquiry.rb
activesupport-5.2.0.rc1 lib/active_support/core_ext/numeric/inquiry.rb
activesupport-5.2.0.beta2 lib/active_support/core_ext/numeric/inquiry.rb
activesupport-5.2.0.beta1 lib/active_support/core_ext/numeric/inquiry.rb
ruby-on-quails-0.1.0 activesupport/lib/active_support/core_ext/numeric/inquiry.rb