123456789_123456789_123456789_123456789_123456789_

Class: RDoc::Parser::PrismRuby::RDocVisitor::MethodSignatureVisitor

Do not use. This class is for internal use only.
Relationships & Source Files
Super Chains via Extension / Inclusion / Inheritance
Class Chain:
self, Prism::Visitor
Instance Chain:
self, Prism::Visitor
Inherits: Prism::Visitor
  • Object
Defined in: lib/rdoc/parser/prism_ruby.rb

Class Method Summary

Instance Attribute Summary

Instance Method Summary

Constructor Details

.newMethodSignatureVisitor

[ GitHub ]

  
# File 'lib/rdoc/parser/prism_ruby.rb', line 1002

def initialize
  @params = nil
  @calls_super = false
  @yields = []
end

Class Method Details

.scan_signature(def_node)

[ GitHub ]

  
# File 'lib/rdoc/parser/prism_ruby.rb', line 991

def scan_signature(def_node)
  visitor = new
  def_node.body&.accept(visitor)
  params = "(#{def_node.parameters&.slice})"
  block_params = visitor.yields.first
  [params, block_params, visitor.calls_super]
end

Instance Attribute Details

#calls_super (readonly)

[ GitHub ]

  
# File 'lib/rdoc/parser/prism_ruby.rb', line 1000

attr_reader :params, :yields, :calls_super

#params (readonly)

[ GitHub ]

  
# File 'lib/rdoc/parser/prism_ruby.rb', line 1000

attr_reader :params, :yields, :calls_super

#yields (readonly)

[ GitHub ]

  
# File 'lib/rdoc/parser/prism_ruby.rb', line 1000

attr_reader :params, :yields, :calls_super

Instance Method Details

#visit_def_node(node)

[ GitHub ]

  
# File 'lib/rdoc/parser/prism_ruby.rb', line 1008

def visit_def_node(node)
  # stop traverse inside nested def
end

#visit_forwarding_super_node(node)

[ GitHub ]

  
# File 'lib/rdoc/parser/prism_ruby.rb', line 1021

def visit_forwarding_super_node(node)
  @calls_super = true
end

#visit_super_node(node)

[ GitHub ]

  
# File 'lib/rdoc/parser/prism_ruby.rb', line 1016

def visit_super_node(node)
  @calls_super = true
  super
end

#visit_yield_node(node)

[ GitHub ]

  
# File 'lib/rdoc/parser/prism_ruby.rb', line 1012

def visit_yield_node(node)
  @yields << (node.arguments&.slice || '')
end