Method: MotionSupport::Inflector#demodulize

Defined in:
motion/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.



148
149
150
151
152
153
154
155
# File 'motion/inflector/methods.rb', line 148

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