From 3ae0616710b10b091baa130f85a56b5ef2c66633 Mon Sep 17 00:00:00 2001 From: "Yukihiro \"Matz\" Matsumoto" Date: Mon, 21 Oct 2013 07:42:50 +0900 Subject: implement Integer#succ in Ruby --- mrblib/numeric.rb | 10 ++++++++++ 1 file changed, 10 insertions(+) (limited to 'mrblib') diff --git a/mrblib/numeric.rb b/mrblib/numeric.rb index daa35c5d6..a5aa3e451 100644 --- a/mrblib/numeric.rb +++ b/mrblib/numeric.rb @@ -34,6 +34,16 @@ class Integer self end + ## + # Returns self + 1 + # + # ISO 15.2.8.3.19 + def next + self + 1 + end + # ISO 15.2.8.3.21 + alias succ next + ## # Calls the given block +self+ times. # -- cgit v1.2.3