docx_replace
docx_replace copied to clipboard
Change in `matches` method output
Changes to be committed: modified: lib/docx_replace.rb modified: lib/docx_replace/version.rb
By default method matches return the exactly same output as unique_matches. Now matches returns a hash of matched values with counted repetitions:
{
"matched_value_1": 1,
"matched_value_2": 4
}
Oh yeah I guess I hadn't noticed that it doesn't actually return the unique matches.
But since the code you wrote returns a different type of data structure (hash instead of array), I'd rather it be a different method altogether. This will also ensure that it doesn't break compatibility.
So could you put your code inside a new method called matches_with_counts (or something like that)? Then in the original method, we could use the same code as before, but add a .uniq to the end.