lib/rh.rb in subhash-0.1.3 vs lib/rh.rb in subhash-0.1.4

- old
+ new

@@ -196,12 +196,12 @@ end # Module to implement common function for Hash and Array class module RhGet def _regexp(key) - return key, [] if key.is_a?(Regexp) - return nil, nil unless key.is_a?(String) + return [key, [], nil] if key.is_a?(Regexp) + return [nil, nil, nil] unless key.is_a?(String) regs = [] regs << [%r{^/(.*)/(e)?$}, []] regs << [%r{^\[/(.*)/(e)?\]$}, []] regs << [%r{^\{/(.*)/(e)?\}$}, {}] @@ -211,10 +211,10 @@ def _loop_on_regs(regs, key) regs.each do |r| init = r[1] reg = r[0].match(key) - return Regexp.new(reg[1]), init, reg[2] if reg && reg[1] + return [Regexp.new(reg[1]), init, reg[2]] if reg && reg[1] end [nil, nil, nil] end def _key_to_s(k)