Class: Solargraph::Pin::Attribute

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

Instance Attribute Summary collapse

Attributes inherited from Base

#location, #name, #namespace

Instance Method Summary collapse

Methods inherited from Base

#==, #comments, #context, #deprecated?, #directives, #docstring, #filename, #infer, #macros, #maybe_directives?, #nearly?, #return_type, #to_s, #try_merge!, #variable?

Methods included from Documenting

#documentation, #helper

Methods included from Conversions

#completion_item, #detail, #link_documentation, #reset_conversions, #resolve_completion_item, #signature_help

Constructor Details

#initialize(location, namespace, name, comments, access, scope, visibility) ⇒ Attribute

Returns a new instance of Attribute.



13
14
15
16
17
18
# File 'lib/solargraph/pin/attribute.rb', line 13

def initialize location, namespace, name, comments, access, scope, visibility
  super(location, namespace, name, comments)
  @access = access
  @scope = scope
  @visibility = visibility
end

Instance Attribute Details

#accessSymbol (readonly)

Returns :reader or :writer.

Returns:

  • (Symbol)

    :reader or :writer



5
6
7
# File 'lib/solargraph/pin/attribute.rb', line 5

def access
  @access
end

#scopeSymbol (readonly)

Returns :class or :instance.

Returns:

  • (Symbol)

    :class or :instance



8
9
10
# File 'lib/solargraph/pin/attribute.rb', line 8

def scope
  @scope
end

#visibilitySymbol (readonly)

Returns :public, :protected, or :private.

Returns:

  • (Symbol)

    :public, :protected, or :private



11
12
13
# File 'lib/solargraph/pin/attribute.rb', line 11

def visibility
  @visibility
end

Instance Method Details

#completion_item_kindObject



24
25
26
# File 'lib/solargraph/pin/attribute.rb', line 24

def completion_item_kind
  Solargraph::LanguageServer::CompletionItemKinds::PROPERTY
end

#kindObject



20
21
22
# File 'lib/solargraph/pin/attribute.rb', line 20

def kind
  Solargraph::Pin::ATTRIBUTE
end

#parameter_namesObject



46
47
48
# File 'lib/solargraph/pin/attribute.rb', line 46

def parameter_names
  []
end

#parametersObject



40
41
42
43
44
# File 'lib/solargraph/pin/attribute.rb', line 40

def parameters
  # Since attributes are generally equivalent to methods, treat
  # them as methods without parameters
  []
end

#pathObject



32
33
34
# File 'lib/solargraph/pin/attribute.rb', line 32

def path
  @path ||= namespace + (scope == :instance ? '#' : '.') + name
end

#return_complex_typeObject



36
37
38
# File 'lib/solargraph/pin/attribute.rb', line 36

def return_complex_type
  @return_complex_type ||= generate_complex_type
end

#symbol_kindObject



28
29
30
# File 'lib/solargraph/pin/attribute.rb', line 28

def symbol_kind
  Solargraph::LanguageServer::SymbolKinds::PROPERTY
end