Ruby has a very useful Range
class for expressing alphabetical and numerical ranges.
There are two methods on this class that I can't seem to distinguish between:Range.include?
and Range.member?
Ruby-doc.org gives exactly the same description for both.
What are the differences between them, if any?
They are aliases of each other. If you expand the source code in the docs you see they both refer to the same internal function.
Range.instance_method(:include?) == Range.instance_method(:member?)
#=> true
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