instance method
deconstantize
Ruby on Rails 8.1.2
Since v3.2.22.5Signature
deconstantize(path)
Removes the rightmost segment from the constant expression in the string.
deconstantize('Net::HTTP') # => "Net" deconstantize('::Net::HTTP') # => "::Net" deconstantize('String') # => "" deconstantize('::String') # => "" deconstantize('') # => ""
See also #demodulize.
Parameters
-
pathreq
Source
# File activesupport/lib/active_support/inflector/methods.rb, line 256
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 256
· View on GitHub
· Improve this page
· Find usages on GitHub
Defined in ActiveSupport::Inflector