diff options
Diffstat (limited to 'mrbgems/mruby-hash-ext/mrblib/hash.rb')
| -rw-r--r-- | mrbgems/mruby-hash-ext/mrblib/hash.rb | 18 |
1 files changed, 0 insertions, 18 deletions
diff --git a/mrbgems/mruby-hash-ext/mrblib/hash.rb b/mrbgems/mruby-hash-ext/mrblib/hash.rb index 640f7daf5..73d1fbe6d 100644 --- a/mrbgems/mruby-hash-ext/mrblib/hash.rb +++ b/mrbgems/mruby-hash-ext/mrblib/hash.rb @@ -131,24 +131,6 @@ class Hash end ## - # call-seq: - # hsh.compact! -> hsh - # - # Removes all nil values from the hash. Returns the hash. - # - # h = { a: 1, b: false, c: nil } - # h.compact! #=> { a: 1, b: false } - # - def compact! - result = self.select { |k, v| !v.nil? } - if result.size == self.size - nil - else - self.replace(result) - end - end - - ## # call-seq: # hsh.fetch(key [, default] ) -> obj # hsh.fetch(key) {| key | block } -> obj |
