blob: 17a04d4d63698cb328e5b068888310eab82b2903 (
plain) (
tree)
|
|
class Integer
# 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
|