Rails Range cover? includes? methods support Range argument
CompareWithRange core extension adds support
Range as an argument
Ruby already has support for these three methods,
but ruby does not support Range value as an argument.
This change is targetted to release and deprecate
with Rails 6.1.
Prior to [email protected]
Range did support value as a
Range argument for the method
Till then, native implementation of
Range#include did not support
value as a range argument.
For Rails > 4.2.7
For Rails <= 4.2.7
Check the include_with_range documentation for more details.
Rails keeps default behavior untouched.
Relevant source code of
from Rails ActiveSupport can be seen below.
After [email protected]
Two new methods have been defined to have similar methods as we have in Ruby 2.6.
also added a deprecation waring with
include_range file as given below.
Subscribe to Ruby in Rails
Get the latest posts delivered right to your inbox