Sha256: 5e1358703f2815f5ecf82225eedb22591cc1ab7cbf95c5e596ec2cbd1f324b79
Contents?: true
Size: 676 Bytes
Versions: 125
Compression:
Stored size: 676 Bytes
Contents
# frozen_string_literal: true class ReeString::Demodulize include Ree::FnDSL fn :demodulize doc(<<~DOC) 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. DOC contract(String => String) def call(path) path = path.to_s if i = path.rindex("::") path[(i + 2)..-1] else path end end end
Version data entries
125 entries across 125 versions & 1 rubygems