diff options
Diffstat (limited to 'mrblib')
| -rw-r--r-- | mrblib/array.rb | 11 | ||||
| -rw-r--r-- | mrblib/hash.rb | 1 |
2 files changed, 12 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) diff --git a/mrblib/hash.rb b/mrblib/hash.rb index 74d3d0534..d15fa434e 100644 --- a/mrblib/hash.rb +++ b/mrblib/hash.rb @@ -142,6 +142,7 @@ class Hash k.inspect + "=>" + v.inspect }.join(", ")+"}" end + # ISO 15.2.13.4.31 (x) alias to_s inspect # 1.8/1.9 Hash#reject! returns Hash; ISO says nothing. |
