lib/solargraph/complex_type/type_methods.rb
# Generate a ComplexType that fully qualifies this type's namespaces.
#
# @param api_map [ApiMap] The ApiMap that performs qualification
# @param context [String] The namespace from which to resolve names
# @return [ComplexType] The generated ComplexType
Generate a ComplexType that fully qualifies this type's namespaces.
Generate a ComplexType that fully qualifies this type ' s namespaces .
def qualify api_map, context = ''
        return ComplexType.new([self]) if duck_type? || void? || undefined?
        recon = (rooted? ? '' : context)
        fqns = api_map.qualify(name, recon)
        if fqns.nil?
          return ComplexType.parse('Boolean') if tag == 'Boolean'
          return ComplexType::UNDEFINED
        end
        fqns = "::#{fqns}" 
        ltypes = key_types.map do |t|
          t.qualify api_map, context
        end
        rtypes = value_types.map do |t|
          t.qualify api_map, context
        end
        if list_parameters?
          Solargraph::ComplexType.parse("#{fqns}<#{rtypes.map(&:tag).join(', ')}>").first
        elsif fixed_parameters?
          Solargraph::ComplexType.parse("#{fqns}(#{rtypes.map(&:tag).join(', ')})").first
        elsif hash_parameters?
          Solargraph::ComplexType.parse("#{fqns}{#{ltypes.map(&:tag).join(', ')} => #{rtypes.map(&:tag).join(', ')}}").first
        else
          Solargraph::ComplexType.parse(fqns).first
        end
      end
def qualify api_map , context = '' return ComplexType . new ( [ self ] ) if duck_type? || void? || undefined? recon = ( rooted? ? '' : context ) fqns = api_map . qualify ( name , recon ) if fqns . nil? return ComplexType . parse ( 'Boolean' ) if tag == 'Boolean' return ComplexType :: UNDEFINED end fqns = "::#{fqns}" ltypes = key_types . map do | t | t . qualify api_map , context end rtypes = value_types . map do | t | t . qualify api_map , context end if list_parameters? Solargraph :: ComplexType . parse ( "#{fqns}<#{rtypes.map(&:tag).join(', ')}>" ) . first elsif fixed_parameters? Solargraph :: ComplexType . parse ( "#{fqns}(#{rtypes.map(&:tag).join(', ')})" ) . first elsif hash_parameters? Solargraph :: ComplexType . parse ( "#{fqns}{#{ltypes.map(&:tag).join(', ')} => #{rtypes.map(&:tag).join(', ')}}" ) . first else Solargraph :: ComplexType . parse ( fqns ) . first end end
Generate a ComplexType that fully qualifies this type's namespaces.
Generate a ComplexType that fully qualifies this type ' s namespaces .
# Ensure the resulting complex type is rooted
The generated ComplexType
The generated ComplexType
ComplexType
api_map
The ApiMap that performs qualification
The ApiMap that performs qualification
context
The namespace from which to resolve names
The namespace from which to resolve names