add Integer#pred (RCR 5)

Submitted by: Robert Dober

This is the revision of Fri Jan 12 12:59:05 EST 2007

See also the current version

ABSTRACT

The Integer class contains the #succ method returning (self + 1). I feel that it would be good to have the symetric method #pred too.

PROBLEM

A user knowing about Integer#succ might want to use Integer#pred.

ANALYSIS

This change should be trivial and does not present any problem with backwards compatibility.

IMPLEMENTATION

class Integer def pred self - 1 end end

Return to top

Copyright © 2006, Ruby Power and Light, LLC