module Solargraph::Pin::Common

Attributes

closure[R]

@return [Pin::Base, nil]

location[R]

@return [Location]

Public Instance Methods

binder() click to toggle source

@return [ComplexType]

# File lib/solargraph/pin/common.rb, line 34
def binder
  @binder || context
end
comments() click to toggle source

@return [String]

# File lib/solargraph/pin/common.rb, line 39
def comments
  @comments ||= ''
end
context() click to toggle source

@return [ComplexType]

# File lib/solargraph/pin/common.rb, line 22
def context
  # Get the static context from the nearest namespace
  @context ||= find_context
end
Also aliased as: full_context
full_context()
Alias for: context
name() click to toggle source

@return [String]

# File lib/solargraph/pin/common.rb, line 12
def name
  @name ||= ''
end
namespace() click to toggle source

@return [String]

# File lib/solargraph/pin/common.rb, line 29
def namespace
  context.namespace.to_s
end
path() click to toggle source

@return [String]

# File lib/solargraph/pin/common.rb, line 44
def path
  @path ||= name.empty? ? context.namespace : "#{context.namespace}::#{name}"
end
return_type() click to toggle source

@return [ComplexType]

# File lib/solargraph/pin/common.rb, line 17
def return_type
  @return_type ||= ComplexType::UNDEFINED
end

Private Instance Methods

find_context() click to toggle source

@return [ComplexType]

# File lib/solargraph/pin/common.rb, line 51
def find_context
  here = closure
  until here.nil?
    if here.is_a?(Pin::Namespace)
      return here.return_type
    elsif here.is_a?(Pin::Method)
      if here.scope == :instance
        return ComplexType.try_parse(here.context.namespace)
      else
        return here.context
      end
    end
    here = here.closure
  end
  ComplexType::ROOT
end