module ActiveSupport::Inflector

def demodulize(path)

See also #deconstantize.

demodulize('') # => ""
demodulize('::Inflections') # => "Inflections"
demodulize('Inflections') # => "Inflections"
demodulize('ActiveSupport::Inflector::Inflections') # => "Inflections"

Removes the module part from the expression in the string.
def demodulize(path)
  path = path.to_s
  if i = path.rindex("::")
    path[(i + 2)..-1]
  else
    path
  end
end