summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorYukihiro "Matz" Matsumoto <[email protected]>2012-05-01 16:53:13 -0700
committerYukihiro "Matz" Matsumoto <[email protected]>2012-05-01 16:53:13 -0700
commit2fe3ffcd16848cc08c68d214a294953e8e3b81e9 (patch)
tree879cc485d927f44dc7cdde5c72799039a9370b8a
parente1f7617ff6c4baee5be4bef18c14cb7f471a0577 (diff)
parent42197ae0a6948768fb48a34ff13621edae0d900b (diff)
downloadmruby-2fe3ffcd16848cc08c68d214a294953e8e3b81e9.tar.gz
mruby-2fe3ffcd16848cc08c68d214a294953e8e3b81e9.zip
Merge pull request #82 from bovi/master
Additional Integer Documentation
-rw-r--r--mrblib/numeric.rb25
1 files changed, 19 insertions, 6 deletions
diff --git a/mrblib/numeric.rb b/mrblib/numeric.rb
index ee5bdcb56..08600b0bf 100644
--- a/mrblib/numeric.rb
+++ b/mrblib/numeric.rb
@@ -1,8 +1,14 @@
-#
-# Integer
-#
+##
+# Integer
+#
+# ISO 15.2.8
class Integer
- # 15.2.8.3.15
+
+ ##
+ # Calls the given block once for each Integer
+ # from +self+ downto +num+.
+ #
+ # ISO 15.2.8.3.15
def downto(num, &block)
raise TypeError, "expected Integer" unless num.kind_of? Integer
i = self
@@ -13,7 +19,10 @@ class Integer
self
end
- # 15.2.8.3.22
+ ##
+ # Calls the given block +self+ times.
+ #
+ # ISO 15.2.8.3.22
def times(&block)
i = 0
while(i < self)
@@ -23,7 +32,11 @@ class Integer
self
end
- # 15.2.8.3.27
+ ##
+ # Calls the given block once for each Integer
+ # from +self+ upto +num+.
+ #
+ # ISO 15.2.8.3.27
def upto(num, &block)
raise TypeError, "expected Integer" unless num.kind_of? Integer
i = self