class RailsParamValidation::Types::Namespace

def self.caller_file

def self.caller_file
  caller_locations(2, 1)[0].path
end

def self.fetch(scope)

def self.fetch(scope)
  path = scope.split('/')
  (path.size - 1).times do
    key = path.join '/'
    return map[key] if map.key? key
    path.pop
  end
  nil
end

def self.store(scope, namespace)

def self.store(scope, namespace)
  map[scope] = namespace
end

def self.with_namespace(namespace, type)

def self.with_namespace(namespace, type)
  if namespace
    path = namespace.to_s.split('.')
    while type.start_with?("_")
      type = type[1..-1]
      path.pop
    end
    "#{path.join(".")}.#{type}".to_sym
  else
    type
  end
end

def map

def map
  @map ||= { '' => nil }
end