summaryrefslogtreecommitdiffhomepage
path: root/mrblib/array.rb
diff options
context:
space:
mode:
authorYukihiro "Matz" Matsumoto <[email protected]>2014-04-01 14:31:39 +0900
committerYukihiro "Matz" Matsumoto <[email protected]>2014-04-01 14:31:39 +0900
commitd9feed6703e6db86334497e90e9751a974545055 (patch)
tree0ef5ddd30bbddcbfb61c3818b480131be5a8aba4 /mrblib/array.rb
parentcf58d0d3e9ca12a922b452473427bcf66598fae3 (diff)
downloadmruby-d9feed6703e6db86334497e90e9751a974545055.tar.gz
mruby-d9feed6703e6db86334497e90e9751a974545055.zip
move Array#inspect implementation to mrblib/array.rb
Diffstat (limited to 'mrblib/array.rb')
-rw-r--r--mrblib/array.rb11
1 files changed, 11 insertions, 0 deletions
diff --git a/mrblib/array.rb b/mrblib/array.rb
index a7f172879..718553e83 100644
--- a/mrblib/array.rb
+++ b/mrblib/array.rb
@@ -85,6 +85,17 @@ class Array
end
##
+ # Private method for Array creation.
+ #
+ # ISO 15.2.12.5.31 (x)
+ def inspect
+ return "[]" if self.size == 0
+ "["+self.map{|x|x.inspect}.join(", ")+"]"
+ end
+ # ISO 15.2.12.5.32 (x)
+ alias to_s inspect
+
+ ##
# Delete element with index +key+
def delete(key, &block)
while i = self.index(key)