In Ruby, the method is string.include?, in the singular, no "s" at the end of "include". In Crystal it is string.includes? in the plural. Not sure if on purpose but I thought to point it out.
It's on purpose. includes? is better grammar, and we don't aim to be compatible with ruby.
@RX14 suggestion on this... I'm referring to the includes? method on collections. This is one case where including the "s" or not can both be valid depending on context, and it has tripped me up. Here are two examples:
do_something if @widget_collection.includes?(widget)
and
do_something if @widgets.include?(widget)
I've used both of these forms in real-world practice, and both are correct. But the latter form is much more common in my work, and in Crystal it spits out undefined method.
From my experience so far, it seems like Crystal is less enthusiastic about having a lot of aliased methods, and I can appreciate that (like Python's "one right way to do it"), but also strives for nice readability like Ruby. So perhaps there is some undefined happy medium?
Most helpful comment
It's on purpose.
includes?is better grammar, and we don't aim to be compatible with ruby.