Class: Integer

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

Instance Method Summary collapse

Instance Method Details

#even?Boolean

Standard in ruby 1.9. See official documentation

Returns:

  • (Boolean)


3
4
5
# File 'lib/backports/integer.rb', line 3

def even?
  self[0].zero?
end

#odd?Boolean

Standard in ruby 1.9. See official documentation

Returns:

  • (Boolean)


8
9
10
# File 'lib/backports/integer.rb', line 8

def odd?
  !even?
end

#ordObject

Standard in ruby 1.9. See official documentation



13
14
15
# File 'lib/backports/integer.rb', line 13

def ord
  self
end

#predObject

Standard in ruby 1.9. See official documentation



23
24
25
# File 'lib/backports/integer.rb', line 23

def pred
  self - 1
end

#succObject

Standard in ruby 1.9. See official documentation



18
19
20
# File 'lib/backports/integer.rb', line 18

def succ
  self + 1
end