class String

String

String

String

Public Instance Methods

characterize() click to toggle source

Convert string to characters only

This will remove accents and umlauts and other special characters

@example Simple Example

'Donald E. Knütz'.characterize #=> 'donald-e-knuth'

# File lib/fedux_org_stdlib/core_ext/string/characterize.rb, line 14
def characterize
  transliterate.parameterize
end
transliterate() click to toggle source

Make umlauts less special

This will remove accents and umlauts and other specialities from characters.

ä => a á => a

@example Simple Example

'Donald E. Knütz'.transliterate #=> 'Donald E. Knutz'

# File lib/fedux_org_stdlib/core_ext/string/transliterate.rb, line 19
def transliterate
  ActiveSupport::Inflector.transliterate(self)
end
underline(character: '-') click to toggle source

Underline a string

@param [String] character ('-')

The character used to underline the string

@return [String]

The string + underline
# File lib/fedux_org_stdlib/core_ext/string/underline.rb, line 11
def underline(character: '-')
  result = []
  result << self
  result << gsub(/./, character)

  result.join("\n")
end