Class: RDoc::Parser::PrismRuby::RDocVisitor::MethodSignatureVisitor
- Inherits:
-
Prism::Visitor
- Object
- Prism::Visitor
- RDoc::Parser::PrismRuby::RDocVisitor::MethodSignatureVisitor
- Defined in:
- lib/rdoc/parser/prism_ruby.rb
Overview
:nodoc:
Instance Attribute Summary collapse
-
#calls_super ⇒ Object
readonly
Returns the value of attribute calls_super.
-
#params ⇒ Object
readonly
Returns the value of attribute params.
-
#yields ⇒ Object
readonly
Returns the value of attribute yields.
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize ⇒ MethodSignatureVisitor
constructor
A new instance of MethodSignatureVisitor.
- #visit_def_node(node) ⇒ Object
- #visit_forwarding_super_node(node) ⇒ Object
- #visit_super_node(node) ⇒ Object
- #visit_yield_node(node) ⇒ Object
Constructor Details
#initialize ⇒ MethodSignatureVisitor
Returns a new instance of MethodSignatureVisitor.
1002 1003 1004 1005 1006 |
# File 'lib/rdoc/parser/prism_ruby.rb', line 1002 def initialize @params = nil @calls_super = false @yields = [] end |
Instance Attribute Details
#calls_super ⇒ Object (readonly)
Returns the value of attribute calls_super.
1000 1001 1002 |
# File 'lib/rdoc/parser/prism_ruby.rb', line 1000 def calls_super @calls_super end |
#params ⇒ Object (readonly)
Returns the value of attribute params.
1000 1001 1002 |
# File 'lib/rdoc/parser/prism_ruby.rb', line 1000 def params @params end |
#yields ⇒ Object (readonly)
Returns the value of attribute yields.
1000 1001 1002 |
# File 'lib/rdoc/parser/prism_ruby.rb', line 1000 def yields @yields end |
Class Method Details
.scan_signature(def_node) ⇒ Object
991 992 993 994 995 996 997 |
# 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 Method Details
#visit_def_node(node) ⇒ Object
1008 1009 1010 |
# 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) ⇒ Object
1021 1022 1023 |
# File 'lib/rdoc/parser/prism_ruby.rb', line 1021 def visit_forwarding_super_node(node) @calls_super = true end |
#visit_super_node(node) ⇒ Object
1016 1017 1018 1019 |
# File 'lib/rdoc/parser/prism_ruby.rb', line 1016 def visit_super_node(node) @calls_super = true super end |
#visit_yield_node(node) ⇒ Object
1012 1013 1014 |
# File 'lib/rdoc/parser/prism_ruby.rb', line 1012 def visit_yield_node(node) @yields << (node.arguments&.slice || '') end |