class Fixnum

Public Instance Methods

pred(n=1) click to toggle source

Provides pred as the opposite of succ.

3.pred(2)  #=> 1

CREDIT: Trans

# File lib/more/facets/succ.rb, line 19
def pred(n=1)
  self - n
end
succ(n=1) click to toggle source

Allows succ to take n increments.

3.succ(2)  #=> 5

CREDIT: Trans

# File lib/more/facets/succ.rb, line 9
def succ(n=1)
  self + n
end