Method: ActiveSupport::Inflector#demodulize
- Defined in:
- activesupport/lib/active_support/inflector/methods.rb
permalink #demodulize(path) ⇒ Object
Removes the module part from the expression in the string.
demodulize('ActiveSupport::Inflector::Inflections') # => "Inflections"
demodulize('Inflections') # => "Inflections"
demodulize('::Inflections') # => "Inflections"
demodulize('') # => ""
See also #deconstantize.
238 239 240 241 242 243 244 245 |
# File 'activesupport/lib/active_support/inflector/methods.rb', line 238 def demodulize(path) path = path.to_s if i = path.rindex("::") path[(i + 2), path.length] else path end end |