./lib/trie_branches.rb in rambling-trie-0.3.3 vs ./lib/trie_branches.rb in rambling-trie-0.3.4

- old
+ new

@@ -47,12 +47,14 @@ unless key.nil? sym_key = key.to_sym return @children[sym_key].has_compressed_branch_for?(chars) if key.length == first_letter.length while not chars.empty? - first_letter += chars.slice!(0) + char = chars.slice!(0) - break unless key.start_with?(first_letter) + break unless key[first_letter.length] == char + + first_letter += char return true if chars.empty? return @children[sym_key].has_compressed_branch_for?(chars) if key.length == first_letter.length end end