Class: Solargraph::Pin::InstanceVariable

Inherits:
BaseVariable show all
Defined in:
lib/solargraph/pin/instance_variable.rb

Instance Attribute Summary

Attributes inherited from BaseVariable

#assignment, #mass_assignment

Attributes inherited from Base

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

Attributes included from Common

#closure, #location

Instance Method Summary collapse

Methods inherited from BaseVariable

#==, #completion_item_kind, #initialize, #nil_assignment?, #probe, #return_type, #return_types_from_node, #symbol_kind, #try_merge!, #type_desc, #variable?

Methods inherited from Base

#==, #all_rooted?, #best_location, #comments, #completion_item_kind, #deprecated?, #desc, #directives, #docstring, #erase_generics, #filename, #identity, #infer, #initialize, #inspect, #macros, #maybe_directives?, #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

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

Constructor Details

This class inherits a constructor from Solargraph::Pin::BaseVariable

Instance Method Details

#binderComplexType

Returns:



7
8
9
# File 'lib/solargraph/pin/instance_variable.rb', line 7

def binder
  closure.binder
end

#contextComplexType

Returns:



17
18
19
20
21
22
23
24
25
26
# File 'lib/solargraph/pin/instance_variable.rb', line 17

def context
  @context ||= begin
    result = super
    if scope == :class
      ComplexType.parse("::Class<#{result.rooted_namespace}>")
    else
      result.reduce_class_type
    end
  end
end

#nearly?(other) ⇒ Boolean

Parameters:

Returns:

  • (Boolean)


29
30
31
# File 'lib/solargraph/pin/instance_variable.rb', line 29

def nearly? other
  super && binder == other.binder
end

#scope::Symbol

Returns:

  • (::Symbol)


12
13
14
# File 'lib/solargraph/pin/instance_variable.rb', line 12

def scope
  closure.binder.scope
end