summaryrefslogtreecommitdiffhomepage
path: root/mrblib/numeric.rb
diff options
context:
space:
mode:
authorMasaki Muranaka <[email protected]>2013-03-31 15:25:33 +0900
committerYukihiro "Matz" Matsumoto <[email protected]>2013-03-31 23:04:45 +0900
commitcbe7a87c68a68f80107143897a29de501e74a833 (patch)
treea5020d108762c22c93122e68056b9520bc9c81c9 /mrblib/numeric.rb
parentdd56b93639ed0d045fd237aa59c2444901aae08c (diff)
downloadmruby-cbe7a87c68a68f80107143897a29de501e74a833.tar.gz
mruby-cbe7a87c68a68f80107143897a29de501e74a833.zip
Move Integer.{floor,ceil,round,truncate} to mrblib/. For maintainability.
Diffstat (limited to 'mrblib/numeric.rb')
-rw-r--r--mrblib/numeric.rb32
1 files changed, 32 insertions, 0 deletions
diff --git a/mrblib/numeric.rb b/mrblib/numeric.rb
index 1d701b1fc..daa35c5d6 100644
--- a/mrblib/numeric.rb
+++ b/mrblib/numeric.rb
@@ -5,6 +5,14 @@
class Integer
##
+ # Returns the receiver simply.
+ #
+ # ISO 15.2.8.3.14
+ def ceil
+ self
+ end
+
+ ##
# Calls the given block once for each Integer
# from +self+ downto +num+.
#
@@ -19,6 +27,14 @@ class Integer
end
##
+ # Returns the receiver simply.
+ #
+ # ISO 15.2.8.3.17
+ def floor
+ self
+ end
+
+ ##
# Calls the given block +self+ times.
#
# ISO 15.2.8.3.22
@@ -32,6 +48,22 @@ class Integer
end
##
+ # Returns the receiver simply.
+ #
+ # ISO 15.2.8.3.24
+ def round
+ self
+ end
+
+ ##
+ # Returns the receiver simply.
+ #
+ # ISO 15.2.8.3.26
+ def truncate
+ self
+ end
+
+ ##
# Calls the given block once for each Integer
# from +self+ upto +num+.
#