Module: SimpleCommandDispatcher::Helpers::TrimAll

Included in:
Camelize, Services::CommandNamespaceService
Defined in:
lib/simple_command_dispatcher/helpers/trim_all.rb

Instance Method Summary collapse

Instance Method Details

#trim_all(string) ⇒ String

Removes all whitespace from the given string, including Unicode whitespace

Parameters:

  • string (String)

    the string to remove whitespace from

Returns:

  • (String)

    the string with all whitespace removed



10
11
12
13
# File 'lib/simple_command_dispatcher/helpers/trim_all.rb', line 10

def trim_all(string)
  # Using Unicode property \p{Space} to match all Unicode whitespace characters
  string.gsub(/\p{Space}+/, '')
end