This is a Ruby tree! It shows every object from the Ruby Programming Language in a tree format.

member?

        # Range.member?

(from ruby core)
---
    include?(object) -> true or false

---

Returns `true` if `object` is an element of `self`, `false` otherwise:

    (1..4).include?(2)        # => true
    (1..4).include?(5)        # => false
    (1..4).include?(4)        # => true
    (1...4).include?(4)       # => false
    ('a'..'d').include?('b')  # => true
    ('a'..'d').include?('e')  # => false
    ('a'..'d').include?('B')  # => false
    ('a'..'d').include?('d')  # => true
    ('a'...'d').include?('d') # => false

If begin and end are numeric, #include? behaves like #cover?

    (1..3).include?(1.5) # => true
    (1..3).cover?(1.5) # => true

But when not numeric, the two methods may differ:

    ('a'..'d').include?('cc') # => false
    ('a'..'d').cover?('cc')   # => true

Related: Range#cover?.

Range#member? is an alias for Range#include?.



      

This is MURDOC! A Ruby documentation browser inspired by Smalltalk-80. It allows you to learn about Ruby by browsing through its class hierarchies, and see any of its methods.