Module: UsefulUtilities::I18n

Extended by:
I18n
Included in:
I18n
Defined in:
lib/useful_utilities/i18n.rb

Overview

I18n utilities

Instance Method Summary collapse

Instance Method Details

#humanize_type(object) ⇒ String

Returns humanized name.

Parameters:

  • object (Object)

Returns:

  • (String)

    humanized name



8
9
10
11
12
13
14
15
16
17
# 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