Class: Numeric

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

Direct Known Subclasses

Flt::Num

Instance Method Summary (collapse)

Instance Method Details

- (Boolean) even?



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

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

- (Boolean) odd?



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

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

- (Object) sign



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

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