lib/docrb/lib/docrb/resolvable.rb
def resolve_container(ref)
      if ref.is_a? Hash
        path = ref
               .slice(:class_path, :target, :name)
               .values
               .flatten
               .compact
        return resolve_container(path)
      end

      ref = [ref] if ref.is_a? Symbol

      if ref.length == 1
        name = ref.first
        # module?
        if (mod = try?(:modules)&.find(&by_name(name)))
          return mod
        end

        # class?
        if (cls = try?(:classes)&.find(&by_name(name)))
          return cls
        end

        # parent?
        return @parent&.resolve_container(ref)
      end

      obj = self
      while ref.length.positive?
        obj = resolve_container(ref.shift)
        return nil if obj.nil?
      end

      obj
    end
# Resolves a container using a provided reference.
#
# ref - Either a reference hash (containing :class_path, :target, :name), or
#       a symbol representing the name of the container being resolved.
#
# Returns a matched container or nil, in case none is found.
Resolves a container using a provided reference.
ref - Either a reference hash (containing :class_path, :target, :name), or
a symbol representing the name of the container being resolved.

Returns a matched container or nil, in case none is found.
Resolves a container using a provided reference . ref - Either a reference hash ( containing : class_path : target : name ) or a symbol representing the name of the container being resolved . Returns a matched container or nil in case none is found .
def resolve_container(ref)
      if ref.is_a? Hash
        path = ref
               .slice(:class_path, :target, :name)
               .values
               .flatten
               .compact
        return resolve_container(path)
      end
      ref = [ref] if ref.is_a? Symbol
      if ref.length == 1
        name = ref.first
        if (mod = try?(:modules)&.find(&by_name(name)))
          return mod
        end
        if (cls = try?(:classes)&.find(&by_name(name)))
          return cls
        end
        return @parent&.resolve_container(ref)
      end
      obj = self
      while ref.length.positive?
        obj = resolve_container(ref.shift)
        return nil if obj.nil?
      end
      obj
    end
def resolve_container ( ref ) if ref . is_a? Hash path = ref . slice ( :class_path , :target , :name ) . values . flatten . compact return resolve_container ( path ) end ref = [ ref ] if ref . is_a? Symbol if ref . length == 1 name = ref . first if ( mod = try? ( :modules ) &. find ( & by_name ( name ) ) ) return mod end if ( cls = try? ( :classes ) &. find ( & by_name ( name ) ) ) return cls end return @parent &. resolve_container ( ref ) end obj = self while ref . length . positive? obj = resolve_container ( ref . shift ) return nil if obj . nil? end obj end
Resolves a container using a provided reference.
Resolves a container using a provided reference .
# module? # class? # parent?
ref