Class: Solargraph::Pin::InstanceVariable

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

Instance Attribute Summary

Attributes inherited from BaseVariable

#assignment

Attributes inherited from Base

#code_object, #location, #name, #path, #return_type

Attributes included from Common

#closure, #location

Instance Method Summary collapse

Methods inherited from BaseVariable

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

Methods inherited from Base

#==, #comments, #completion_item_kind, #deprecated?, #directives, #docstring, #filename, #identity, #infer, #initialize, #inspect, #macros, #maybe_directives?, #probe, #probed?, #proxied?, #proxy, #realize, #symbol_kind, #to_s, #try_merge!, #typify, #variable?

Methods included from Documenting

#documentation

Methods included from Conversions

#completion_item, #detail, #link_documentation, #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

#binderObject



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

def binder
  closure.binder
end

#contextObject



14
15
16
17
18
19
20
21
22
23
# File 'lib/solargraph/pin/instance_variable.rb', line 14

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

#nearly?(other) ⇒ Boolean

Returns:

  • (Boolean)


25
26
27
# File 'lib/solargraph/pin/instance_variable.rb', line 25

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

#scopeObject



10
11
12
# File 'lib/solargraph/pin/instance_variable.rb', line 10

def scope
  closure.binder.scope
end