Method: Capybara::Helpers.normalize_whitespace

Defined in:
lib/capybara/helpers.rb

.normalize_whitespace(text) ⇒ String

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Deprecated.

Normalizes whitespace space by stripping leading and trailing whitespace and replacing sequences of whitespace characters with a single space.

Parameters:

  • text (String)

    Text to normalize

Returns:

  • (String)

    Normalized text



17
18
19
20
# File 'lib/capybara/helpers.rb', line 17

def normalize_whitespace(text)
  Capybara::Helpers.warn 'DEPRECATED: Capybara::Helpers::normalize_whitespace is deprecated, please update your driver'
  text.to_s.gsub(/[[:space:]]+/, ' ').strip
end