docx_replace icon indicating copy to clipboard operation
docx_replace copied to clipboard

Change in `matches` method output

Open mareczek opened this issue 10 years ago • 1 comments

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 }

mareczek avatar Jun 16 '15 07:06 mareczek

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.

adamalbrecht avatar Jul 07 '15 17:07 adamalbrecht