Class: Solargraph::Pin::Block

Inherits:
Closure show all
Defined in:
lib/solargraph/pin/block.rb

Instance Attribute Summary collapse

Attributes inherited from Closure

#scope

Attributes inherited from Base

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

Attributes included from Common

#closure, #location

Instance Method Summary collapse

Methods inherited from Closure

#context, #gates

Methods inherited from Base

#==, #comments, #completion_item_kind, #deprecated?, #directives, #docstring, #filename, #identity, #infer, #inspect, #macros, #maybe_directives?, #nearly?, #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, #context, #name, #namespace, #path, #return_type

Constructor Details

#initialize(receiver: nil, args: [], context: nil, **splat) ⇒ Block

Returns a new instance of Block.



11
12
13
14
15
16
# File 'lib/solargraph/pin/block.rb', line 11

def initialize receiver: nil, args: [], context: nil, **splat
  super(**splat)
  @receiver = receiver
  @context = context
  @parameters = args
end

Instance Attribute Details

#receiverParser::AST::Node (readonly)

The signature of the method that receives this block.

Returns:

  • (Parser::AST::Node)


9
10
11
# File 'lib/solargraph/pin/block.rb', line 9

def receiver
  @receiver
end

Instance Method Details

#binderObject



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

def binder
  @binder || closure.binder
end

#parameter_namesArray<String>

Returns:



34
35
36
# File 'lib/solargraph/pin/block.rb', line 34

def parameter_names
  @parameter_names ||= parameters.map(&:name)
end

#parametersArray<String>

Returns:



29
30
31
# File 'lib/solargraph/pin/block.rb', line 29

def parameters
  @parameters ||= []
end

#rebind(api_map) ⇒ void

This method returns an undefined value.

Parameters:



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

def rebind api_map
  @binder ||= binder_or_nil(api_map)
end