Class: Solargraph::Pin::ProxyType

Inherits:
Base
  • Object
show all
Defined in:
lib/solargraph/pin/proxy_type.rb

Instance Attribute Summary

Attributes inherited from Base

#code_object, #location, #name, #path, #return_type, #source, #type_location

Attributes included from Common

#closure, #location

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from Base

#==, #all_rooted?, #best_location, #comments, #completion_item_kind, #deprecated?, #desc, #directives, #docstring, #erase_generics, #filename, #identity, #infer, #inspect, #macros, #maybe_directives?, #nearly?, #presence_certain?, #probe, #probed?, #proxied?, #proxy, #realize, #resolve_generics, #resolve_generics_from_context, #symbol_kind, #to_rbs, #to_s, #transform_types, #try_merge!, #type_desc, #typify, #variable?

Methods included from Documenting

#documentation, normalize_indentation, strip_html_comments

Methods included from Conversions

#completion_item, #completion_item_kind, #deprecated?, #detail, #link_documentation, #probed?, #proxied?, #reset_conversions, #resolve_completion_item, #signature_help, #text_documentation

Methods included from Common

#binder, #comments, #name, #namespace, #path, #return_type

Constructor Details

#initialize(return_type: ComplexType::UNDEFINED, binder: nil, **splat) ⇒ ProxyType

Returns a new instance of ProxyType.

Parameters:

  • return_type (ComplexType) (defaults to: ComplexType::UNDEFINED)


7
8
9
10
11
# File 'lib/solargraph/pin/proxy_type.rb', line 7

def initialize return_type: ComplexType::UNDEFINED, binder: nil, **splat
  super(**splat)
  @return_type = return_type
  @binder = binder if binder
end

Class Method Details

.anonymous(context, closure: nil, binder: nil) ⇒ ProxyType

Parameters:

Returns:



21
22
23
24
25
26
27
28
29
30
31
32
# File 'lib/solargraph/pin/proxy_type.rb', line 21

def self.anonymous context, closure: nil, binder: nil
  unless closure
    parts = context.namespace.split('::')
    namespace = parts[0..-2].join('::').to_s
    closure = Solargraph::Pin::Namespace.new(name: namespace)
  end
  # name = parts.last.to_s
  # ProxyType.new(nil, namespace, name, return_type)
  ProxyType.new(
    closure: closure, return_type: context, binder: binder || context
  )
end

Instance Method Details

#contextObject



13
14
15
# File 'lib/solargraph/pin/proxy_type.rb', line 13

def context
  @return_type
end