Class: Integer

Inherits:
Object show all
Defined in:
lib/roebe/core/integer.rb

Overview

#

Usage examples:

5.is_odd?
5.is_even?
#

Instance Method Summary collapse

Instance Method Details

#is_even?Boolean

#

is_even?

#

Returns:

  • (Boolean)


33
34
35
# File 'lib/roebe/core/integer.rb', line 33

def is_even?
  self % 2 == 0
end

#is_odd?Boolean

#

is_odd?

#

Returns:

  • (Boolean)


26
27
28
# File 'lib/roebe/core/integer.rb', line 26

def is_odd?
  self % 2 != 0
end

#±(i) ⇒ Object

#

±

Usage example:

7 ± 2
#


19
20
21
# File 'lib/roebe/core/integer.rb', line 19

def ±(i)
  [self-i, self+i]
end