Class: Solargraph::Source::Chain::Call
- Inherits:
-
Link
- Object
- Link
- Solargraph::Source::Chain::Call
show all
- Defined in:
- lib/solargraph/source/chain/call.rb
Instance Attribute Summary collapse
Attributes inherited from Link
#last_context
Instance Method Summary
collapse
Methods inherited from Link
#==, #clone_body, #clone_head, #constant?, #head?, #inspect, #nullable?, #undefined?
Constructor Details
#initialize(word, arguments = [], block = nil) ⇒ Call
Returns a new instance of Call.
19
20
21
22
23
24
|
# File 'lib/solargraph/source/chain/call.rb', line 19
def initialize word, arguments = [], block = nil
@word = word
@arguments = arguments
@block = block
fix_block_pass
end
|
Instance Attribute Details
#arguments ⇒ ::Array<Chain>
11
12
13
|
# File 'lib/solargraph/source/chain/call.rb', line 11
def arguments
@arguments
end
|
14
15
16
|
# File 'lib/solargraph/source/chain/call.rb', line 14
def block
@block
end
|
#word ⇒ String
8
9
10
|
# File 'lib/solargraph/source/chain/call.rb', line 8
def word
@word
end
|
Instance Method Details
#resolve(api_map, name_pin, locals) ⇒ Object
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
|
# File 'lib/solargraph/source/chain/call.rb', line 33
def resolve api_map, name_pin, locals
return super_pins(api_map, name_pin) if word == 'super'
return yield_pins(api_map, name_pin) if word == 'yield'
found = if head?
locals.select { |p| p.name == word }
else
[]
end
return inferred_pins(found, api_map, name_pin.context, locals) unless found.empty?
pins = name_pin.binder.each_unique_type.flat_map do |context|
api_map.get_method_stack(context.namespace == '' ? '' : context.tag, word, scope: context.scope)
end
return [] if pins.empty?
inferred_pins(pins, api_map, name_pin.context, locals)
end
|
#with_block? ⇒ Boolean
26
27
28
|
# File 'lib/solargraph/source/chain/call.rb', line 26
def with_block?
!!@block
end
|