class Dry::Inflector

def humanize(input)

Other tags:
    Since: - 0.1.0

Returns:
  • (String) - the humanized string

Parameters:
  • input (String, Symbol) -- the input
def humanize(input)
  input = input.to_s
  result = inflections.humans.apply_to(input)
  result.delete_suffix!("_id")
  result.tr!("_", " ")
  match = /(\W)/.match(result)
  separator = match ? match[0] : DEFAULT_SEPARATOR
  result.split(separator).map.with_index { |word, index|
    inflections.acronyms.apply_to(word, capitalize: index.zero?)
  }.join(separator)
end