Class: Numeric

Inherits:
Object show all
Defined in:
lib/flt/sugar.rb

Direct Known Subclasses

Flt::Num

Instance Method Summary collapse

Instance Method Details

#even?Boolean



74
75
76
# File 'lib/flt/sugar.rb', line 74

def even?
  self.modulo(2) == 0
end

#odd?Boolean



78
79
80
# File 'lib/flt/sugar.rb', line 78

def odd?
  self.modulo(2) == 1
end

#signObject



82
83
84
# File 'lib/flt/sugar.rb', line 82

def sign
  self < 0 ? -1 : +1
end