Small refactoring in `mruby-hash-ext`.

parent 8b437546
...@@ -126,12 +126,12 @@ class Hash ...@@ -126,12 +126,12 @@ class Hash
# #
def compact! def compact!
h = {}
keys = self.keys keys = self.keys
nk = keys.select{|k| nk = keys.select{|k|
self[k] != nil self[k] != nil
} }
return nil if (keys.size == nk.size) return nil if (keys.size == nk.size)
h = {}
nk.each {|k| nk.each {|k|
h[k] = self[k] h[k] = self[k]
} }
...@@ -486,6 +486,7 @@ class Hash ...@@ -486,6 +486,7 @@ class Hash
end end
hash hash
end end
## ##
# call-seq: # call-seq:
# hsh.transform_values! {|key| block } -> hsh # hsh.transform_values! {|key| block } -> hsh
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment