Method: ActiveSupport::Inflector#demodulize

Defined in:
lib/active_support/inflector/methods.rb

#demodulize(path) ⇒ Object

Removes the module part from the expression in the string.

'ActiveRecord::CoreExtensions::String::Inflections'.demodulize # => "Inflections"
'Inflections'.demodulize                                       # => "Inflections"
'::Inflections'.demodulize                                     # => "Inflections"
''.demodulize                                                  # => ""

See also deconstantize.



199
200
201
202
203
204
205
206
# File 'lib/active_support/inflector/methods.rb', line 199

def demodulize(path)
  path = path.to_s
  if i = path.rindex('::')
    path[(i+2)..-1]
  else
    path
  end
end