lib/ihash.rb in subhash-0.1.3 vs lib/ihash.rb in subhash-0.1.4
- old
+ new
@@ -610,11 +610,11 @@
private
def _keys_match_lexist(re, res, sp, _opts)
_keys_match_loop_lexist(re, res, sp)
- return 1 + res.max if res.length > 0
+ return res.max if res.length > 0
0
end
def _keys_match_loop_lexist(re, res, sp)
keys.sort.each do |k|
@@ -622,10 +622,12 @@
next unless re.match(k_re)
if sp.length == 0
res << 1
else
- res << self[k].rh_lexist?(sp) if [Array, Hash].include?(self[k].class)
+ if [Array, Hash].include?(self[k].class)
+ res << 1 + self[k].rh_lexist?(sp)
+ end
end
end
end
def _keys_match(re, res, sp, opts)