Method: String#deconstantize

Defined in:
lib/core_ext/string/inflections.rb

#deconstantizeObject

Removes the rightmost segment from the constant expression in the string.

'Net::HTTP'.deconstantize   # => "Net"
'::Net::HTTP'.deconstantize # => "::Net"
'String'.deconstantize      # => ""
'::String'.deconstantize    # => ""
''.deconstantize            # => ""

See also demodulize.



150
151
152
# File 'lib/core_ext/string/inflections.rb', line 150

def deconstantize
  CoreExt::Inflector.deconstantize(self)
end