summaryrefslogtreecommitdiffhomepage
path: root/mrbgems/mruby-hash-ext/mrblib/hash.rb
diff options
context:
space:
mode:
authorYukihiro "Matz" Matsumoto <[email protected]>2017-08-09 21:20:50 +0900
committerYukihiro "Matz" Matsumoto <[email protected]>2017-08-09 21:20:50 +0900
commit6c61a60609e973f3dec00e86ca6f1519ae83e1e3 (patch)
tree4ca852347e8c94c8ab6114a0ff98657f9450e0f4 /mrbgems/mruby-hash-ext/mrblib/hash.rb
parent4d46f366acbba00de1a56c2d3df85fceaaecd1a0 (diff)
downloadmruby-6c61a60609e973f3dec00e86ca6f1519ae83e1e3.tar.gz
mruby-6c61a60609e973f3dec00e86ca6f1519ae83e1e3.zip
Implement `Hash#compact!` in C; ref #3769
Diffstat (limited to 'mrbgems/mruby-hash-ext/mrblib/hash.rb')
-rw-r--r--mrbgems/mruby-hash-ext/mrblib/hash.rb18
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