I've always wondered if there is an inverse method for include?
.
So that given:
str = "a"
ary = ["a", "b", "c"]
I can check if the string is in the array rather than if the array contains the string. Something like:
str.in?(ary)
I can't think of a situation where this is necessary, but often I think from that direction rather than the other way around.
There is no such method in Ruby itself, but there is such method in Rails - Object#in
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With