Method: String#exclude?

Defined in:
lib/active_support/core_ext/string/exclude.rb

#exclude?(string) ⇒ Boolean

The inverse of String#include?. Returns true if the string does not include the other string.

"hello".exclude? "lo" # => false
"hello".exclude? "ol" # => true
"hello".exclude? ?h   # => false

Returns:

  • (Boolean)


10
11
12
# File 'lib/active_support/core_ext/string/exclude.rb', line 10

def exclude?(string)
  !include?(string)
end