Method: Vedeu::Common#demodulize

Defined in:
lib/vedeu/common.rb

#demodulize(klass) ⇒ String

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Removes the module part from the expression in the string.

Examples:

demodulize('Vedeu::SomeModule::SomeClass') # => "SomeClass"

Parameters:

  • klass (Class|String)

Returns:

  • (String)


25
26
27
28
29
# File 'lib/vedeu/common.rb', line 25

def demodulize(klass)
  klass = klass.to_s

  klass[(klass.rindex('::') + 2)..-1]
end