Class: RubyLsp::Ree::ParsedLinkNode
- Inherits:
-
Object
- Object
- RubyLsp::Ree::ParsedLinkNode
show all
- Defined in:
- lib/ruby_lsp/ruby_lsp_ree/parsing/parsed_link_node.rb
Defined Under Namespace
Classes: ImportItem, LinkedObject
Constant Summary
collapse
- FROM_ARG_KEY =
'from'
- IMPORT_ARG_KEY =
'import'
- AS_ARG_KEY =
'as'
Instance Attribute Summary collapse
Instance Method Summary
collapse
Constructor Details
#initialize(node, document_package = nil) ⇒ ParsedLinkNode
Returns a new instance of ParsedLinkNode.
42
43
44
45
46
47
48
49
|
# File 'lib/ruby_lsp/ruby_lsp_ree/parsing/parsed_link_node.rb', line 42
def initialize(node, document_package = nil)
@node = node
@document_package = document_package
@name = parse_name
parse_params
parse_linked_objects
end
|
Instance Attribute Details
#document_package ⇒ Object
Returns the value of attribute document_package.
4
5
6
|
# File 'lib/ruby_lsp/ruby_lsp_ree/parsing/parsed_link_node.rb', line 4
def document_package
@document_package
end
|
#from_param ⇒ Object
Returns the value of attribute from_param.
4
5
6
|
# File 'lib/ruby_lsp/ruby_lsp_ree/parsing/parsed_link_node.rb', line 4
def from_param
@from_param
end
|
#import_items ⇒ Object
Returns the value of attribute import_items.
4
5
6
|
# File 'lib/ruby_lsp/ruby_lsp_ree/parsing/parsed_link_node.rb', line 4
def import_items
@import_items
end
|
#kw_args ⇒ Object
Returns the value of attribute kw_args.
4
5
6
|
# File 'lib/ruby_lsp/ruby_lsp_ree/parsing/parsed_link_node.rb', line 4
def kw_args
@kw_args
end
|
#linked_objects ⇒ Object
Returns the value of attribute linked_objects.
4
5
6
|
# File 'lib/ruby_lsp/ruby_lsp_ree/parsing/parsed_link_node.rb', line 4
def linked_objects
@linked_objects
end
|
#name ⇒ Object
Returns the value of attribute name.
4
5
6
|
# File 'lib/ruby_lsp/ruby_lsp_ree/parsing/parsed_link_node.rb', line 4
def name
@name
end
|
#node ⇒ Object
Returns the value of attribute node.
4
5
6
|
# File 'lib/ruby_lsp/ruby_lsp_ree/parsing/parsed_link_node.rb', line 4
def node
@node
end
|
Instance Method Details
#file_path_type? ⇒ Boolean
81
82
83
|
# File 'lib/ruby_lsp/ruby_lsp_ree/parsing/parsed_link_node.rb', line 81
def file_path_type?
false
end
|
#first_arg_location ⇒ Object
109
110
111
|
# File 'lib/ruby_lsp/ruby_lsp_ree/parsing/parsed_link_node.rb', line 109
def first_arg_location
@node.arguments.arguments.first.location
end
|
#from_arg_value ⇒ Object
68
69
70
71
|
# File 'lib/ruby_lsp/ruby_lsp_ree/parsing/parsed_link_node.rb', line 68
def from_arg_value
return unless @from_param
@from_param.value.respond_to?(:unescaped) ? @from_param.value.unescaped : nil
end
|
#has_import_section? ⇒ Boolean
101
102
103
|
# File 'lib/ruby_lsp/ruby_lsp_ree/parsing/parsed_link_node.rb', line 101
def has_import_section?
!!import_arg
end
|
#has_kwargs? ⇒ Boolean
105
106
107
|
# File 'lib/ruby_lsp/ruby_lsp_ree/parsing/parsed_link_node.rb', line 105
def has_kwargs?
!!@kw_args
end
|
#has_linked_object?(object_name) ⇒ Boolean
121
122
123
|
# File 'lib/ruby_lsp/ruby_lsp_ree/parsing/parsed_link_node.rb', line 121
def has_linked_object?(object_name)
@linked_objects.map(&:name).include?(object_name)
end
|
#import_block_close_location ⇒ Object
117
118
119
|
# File 'lib/ruby_lsp/ruby_lsp_ree/parsing/parsed_link_node.rb', line 117
def import_block_close_location
raise "abstract method"
end
|
#import_block_open_location ⇒ Object
113
114
115
|
# File 'lib/ruby_lsp/ruby_lsp_ree/parsing/parsed_link_node.rb', line 113
def import_block_open_location
raise "abstract method"
end
|
#import_link_type? ⇒ Boolean
89
90
91
|
# File 'lib/ruby_lsp/ruby_lsp_ree/parsing/parsed_link_node.rb', line 89
def import_link_type?
false
end
|
#imports ⇒ Object
97
98
99
|
# File 'lib/ruby_lsp/ruby_lsp_ree/parsing/parsed_link_node.rb', line 97
def imports
@import_items.map(&:name)
end
|
#link_package_name ⇒ Object
55
56
57
|
# File 'lib/ruby_lsp/ruby_lsp_ree/parsing/parsed_link_node.rb', line 55
def link_package_name
raise "abstract method"
end
|
#link_type ⇒ Object
77
78
79
|
# File 'lib/ruby_lsp/ruby_lsp_ree/parsing/parsed_link_node.rb', line 77
def link_type
raise "abstract method"
end
|
#location ⇒ Object
59
60
61
|
# File 'lib/ruby_lsp/ruby_lsp_ree/parsing/parsed_link_node.rb', line 59
def location
@node.location
end
|
#multi_object_link? ⇒ Boolean
51
52
53
|
# File 'lib/ruby_lsp/ruby_lsp_ree/parsing/parsed_link_node.rb', line 51
def multi_object_link?
false
end
|
#name_arg_node ⇒ Object
73
74
75
|
# File 'lib/ruby_lsp/ruby_lsp_ree/parsing/parsed_link_node.rb', line 73
def name_arg_node
@node.arguments.arguments.first
end
|
#object_name_type? ⇒ Boolean
85
86
87
|
# File 'lib/ruby_lsp/ruby_lsp_ree/parsing/parsed_link_node.rb', line 85
def object_name_type?
false
end
|
#parse_imports ⇒ Object
93
94
95
|
# File 'lib/ruby_lsp/ruby_lsp_ree/parsing/parsed_link_node.rb', line 93
def parse_imports
@import_items ||= get_import_items
end
|
#usage_name ⇒ Object
63
64
65
66
|
# File 'lib/ruby_lsp/ruby_lsp_ree/parsing/parsed_link_node.rb', line 63
def usage_name
return @alias_name if @alias_name
@name
end
|