summaryrefslogtreecommitdiffhomepage
path: root/mrblib/array.rb
diff options
context:
space:
mode:
Diffstat (limited to 'mrblib/array.rb')
-rw-r--r--mrblib/array.rb13
1 files changed, 10 insertions, 3 deletions
diff --git a/mrblib/array.rb b/mrblib/array.rb
index 3218aa858..bd8d5930f 100644
--- a/mrblib/array.rb
+++ b/mrblib/array.rb
@@ -84,13 +84,20 @@ class Array
self
end
+ def _inspect
+ return "[]" if self.size == 0
+ "["+self.map{|x|x.inspect}.join(", ")+"]"
+ end
##
- # Private method for Array creation.
+ # Return the contents of this array as a string.
#
# ISO 15.2.12.5.31 (x)
def inspect
- return "[]" if self.size == 0
- "["+self.map{|x|x.inspect}.join(", ")+"]"
+ begin
+ self._inspect
+ rescue SystemStackError
+ "[...]"
+ end
end
# ISO 15.2.12.5.32 (x)
alias to_s inspect