instance method
deconstantize
Ruby on Rails 4.2.9
Since v3.2.22.5Signature
deconstantize(path)
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.
Parameters
-
pathreq
Source
# File activesupport/lib/active_support/inflector/methods.rb, line 217
def deconstantize(path)
path.to_s[0, path.rindex('::') || 0] # implementation based on the one in facets' Module#spacename
end
Defined in activesupport/lib/active_support/inflector/methods.rb line 217
· View on GitHub
· Improve this page
· Find usages on GitHub
Defined in ActiveSupport::Inflector