soutaro/strong_json

`match?` alias for `=~` in `StrongJSON::Type::Match`

Closed this issue · 2 comments

Does it make sense to add match? alias for =~?

module Match
def =~(value)
coerce(value)
true
rescue
false
end
def ===(value)
self =~ value
end
end

This idea is inspired by Regexp#match? and Regexp#=~.

In addition (it might be trivial), I think the alias can avoid warnings by RuboCop's Performance/RegexpMatch rule.

I'm not very positive for adding another exact alias match? because it does not have any special meaning in Ruby, while I don't have strong reason to reject the idea. So, you can open a pull request.

Thanks for the response! I see. 👍
The idea does not make sense well, so I'll close this issue.

In the future, when it will be necessary for me, I may open a PR. 😅