Method: Upmin::Model.humanized_name

Defined in:
lib/upmin/model.rb

.humanized_name(type = :plural) ⇒ Object



181
182
183
184
185
186
187
188
189
# File 'lib/upmin/model.rb', line 181

def Model.humanized_name(type = :plural)
  names = @display_name ? [@display_name] : model_class_name.split(/(?=[A-Z])/).map{|n| n.gsub(":", "")}

  if type == :plural
    names[names.length-1] = names.last.pluralize
  end

  return names.join(" ")
end