Method: String#humanize

Defined in:
lib/awestruct/util/inflector.rb

#humanizeObject

Capitalizes the first word and turns underscores into spaces and strips _id. Like titleize, this is meant for creating pretty output.

Examples

"employee_salary" #=> "Employee salary"
"author_id" #=> "Author"


175
176
177
# File 'lib/awestruct/util/inflector.rb', line 175

def humanize
  gsub(/_id$/, "").gsub(/_/, " ").capitalize
end