class Zeitwerk::Loader::ConstantPathValidator

@private

Constants

CNAME_VALIDATOR

Public Instance Methods

validate!(possible_cpath) click to toggle source
Technically, this validation works with symbols, but API boundary restricts
input to strings, so we assume strings, and we test strings.

: (String) -> String ! NameError

# File lib/zeitwerk/loader/constant_path_validator.rb, line 10
def validate!(possible_cpath)
  # We do this before validating because as of this writing, TruffleRuby
  # raises TypeError if the argument has leading colons.
  possible_cpath = possible_cpath.delete_prefix('::')
  CNAME_VALIDATOR.const_defined?(possible_cpath, false)
  possible_cpath
end