Skip to main content
Mod Removes Wiki by Doorknob
added 3 characters in body
Source Link
Cristian Lupascu
  • 8.7k
  • 2
  • 25
  • 52

If you need to find if a particular element e is inside a range r***, you can use

r===e

instead of the longer:

r.cover?(e) # only works if `r.exclude_end?` is false

instead of the longer:or

r.member?(e)

or

r.include?(e)

*This is true only if r.exclude_end? is false

If you need to find if a particular element e is inside a range r***, you can use

r.cover?(e)

instead of the longer:

r.member?(e)

or

r.include?(e)

*This is true only if r.exclude_end? is false

If you need to find if a particular element e is inside a range r, you can use

r===e

instead of the longer:

r.cover?(e) # only works if `r.exclude_end?` is false

or

r.member?(e)

or

r.include?(e)
Source Link
Cristian Lupascu
  • 8.7k
  • 2
  • 25
  • 52

If you need to find if a particular element e is inside a range r***, you can use

r.cover?(e)

instead of the longer:

r.member?(e)

or

r.include?(e)

*This is true only if r.exclude_end? is false