Skip to content

Conversation

@mareczek
Copy link

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
}

	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
}
@adamalbrecht
Copy link
Owner

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants