Method: Hanami::Utils::String.titleize

Defined in:
lib/hanami/utils/string.rb

.titleize(input) ⇒ ::String

Returns a titleized version of the string

Examples:

require 'hanami/utils/string'

Hanami::Utils::String.titleize('hanami utils') # => "Hanami Utils"

Parameters:

  • input (::String)

    the input

Returns:

  • (::String)

    the transformed string

Since:

  • 1.1.0



157
158
159
160
# File 'lib/hanami/utils/string.rb', line 157

def self.titleize(input)
  string = ::String.new(input.to_s)
  underscore(string).split(CLASSIFY_SEPARATOR).map(&:capitalize).join(TITLEIZE_SEPARATOR)
end