diff options
| author | Yukihiro "Matz" Matsumoto <[email protected]> | 2018-09-20 09:07:24 +0900 |
|---|---|---|
| committer | Yukihiro "Matz" Matsumoto <[email protected]> | 2018-09-20 09:07:24 +0900 |
| commit | 3820ef791f3ccb766956d12534ae519f4923ac7e (patch) | |
| tree | 5be861557ee94f0918e8a3ab5c1f2c7f97dff9ae | |
| parent | 8b43754644660c9dcdc6b8b18a1917f01e77479e (diff) | |
| download | mruby-3820ef791f3ccb766956d12534ae519f4923ac7e.tar.gz mruby-3820ef791f3ccb766956d12534ae519f4923ac7e.zip | |
Small refactoring in `mruby-hash-ext`.
| -rw-r--r-- | mrbgems/mruby-hash-ext/mrblib/hash.rb | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/mrbgems/mruby-hash-ext/mrblib/hash.rb b/mrbgems/mruby-hash-ext/mrblib/hash.rb index eaf54b871..61e4c890c 100644 --- a/mrbgems/mruby-hash-ext/mrblib/hash.rb +++ b/mrbgems/mruby-hash-ext/mrblib/hash.rb @@ -126,12 +126,12 @@ class Hash # def compact! - h = {} keys = self.keys nk = keys.select{|k| self[k] != nil } return nil if (keys.size == nk.size) + h = {} nk.each {|k| h[k] = self[k] } @@ -486,6 +486,7 @@ class Hash end hash end + ## # call-seq: # hsh.transform_values! {|key| block } -> hsh |
