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, #source

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.

Parameters:



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

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



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

def binder
  @binder || closure.binder
end

#parameter_namesArray<String>

Returns:

  • (Array<String>)


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

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

#parametersArray<Parameter>

Returns:



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

def parameters
  @parameters ||= []
end

#rebind(api_map) ⇒ void

This method returns an undefined value.

Parameters:



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

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