module UsefulUtilities::I18n

I18n utilities

Public Instance Methods

humanize_type(object) click to toggle source

@param object [Object] @return [String] humanized name

# File lib/useful_utilities/i18n.rb, line 8
def humanize_type(object)
  klass = case object
          when Class then object
          when object.respond_to?(:klass) then object.klass
          else
            object.class
          end

  klass.respond_to?(:model_name) ? klass.model_name.human : klass.to_s.underscore.humanize
end