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"

See also deconstantize.



159
160
161
162
163
164
165
166
# File 'lib/active_support/inflector/methods.rb', line 159

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