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, #context, #location

Instance Method Summary collapse

Methods inherited from Closure

#context, #gates, #generics, #generics_as_rbs

Methods inherited from Base

#==, #comments, #completion_item_kind, #deprecated?, #desc, #directives, #docstring, #erase_generics, #filename, #identity, #infer, #inspect, #macros, #maybe_directives?, #nearly?, #probe, #probed?, #proxied?, #proxy, #realize, #resolve_generics, #resolve_generics_from_context, #symbol_kind, #to_rbs, #to_s, #transform_types, #try_merge!, #typify, #variable?

Methods included from Documenting

#documentation, normalize_indentation, strip_html_comments

Methods included from Conversions

#completion_item, #completion_item_kind, #deprecated?, #detail, #link_documentation, #probed?, #proxied?, #reset_conversions, #resolve_completion_item, #signature_help, #text_documentation

Methods included from Common

#comments, #name, #namespace, #path, #return_type

Constructor Details

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

Returns a new instance of Block.

Parameters:

  • receiver (Parser::AST::Node, nil) (defaults to: nil)
  • node (Parser::AST::Node, nil) (defaults to: nil)
  • context (ComplexType, nil) (defaults to: nil)
  • args (::Array<Parameter>) (defaults to: [])


16
17
18
19
20
21
22
# File 'lib/solargraph/pin/block.rb', line 16

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

Instance Attribute Details

#nodeParser::AST::Node (readonly)

Returns:

  • (Parser::AST::Node)


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

def node
  @node
end

#receiverParser::AST::Node (readonly)

Returns:

  • (Parser::AST::Node)


7
8
9
# File 'lib/solargraph/pin/block.rb', line 7

def receiver
  @receiver
end

Instance Method Details

#binderObject



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

def binder
  @rebind&.defined? ? @rebind : closure.binder
end

#parameter_names::Array<String>

Returns:

  • (::Array<String>)


40
41
42
# File 'lib/solargraph/pin/block.rb', line 40

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

#parameters::Array<Parameter>

Returns:



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

def parameters
  @parameters ||= []
end

#rebind(api_map) ⇒ void

This method returns an undefined value.

Parameters:



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

def rebind api_map
  @rebind ||= maybe_rebind(api_map)
end