Submitted by: Robert Dober
This revision by: Robert Dober
Date: Mon Jan 15 11:47:08 -0500 2007
The Integer class contains the #succ method returning (self + 1). I feel that it would be good to have the symetric method #pred too.
A user knowing about Integer#succ might want to use Integer#pred.
Add the Integer#pred method that shall return (self – 1).
This change should be trivial and does not present any problem with backwards compatibility.
class Integer
def pred
self - 1
end
end
Comments
Return to top
Copyright © 2006, Ruby Power and Light, LLC