Class: AppMap::Inspect::StaticMethodParseNode
- Inherits:
-
MethodParseNode
- Object
- Struct
- ParseNodeStruct
- ParseNode
- MethodParseNode
- AppMap::Inspect::StaticMethodParseNode
- Defined in:
- lib/appmap/inspect/parse_node.rb
Overview
A method defines as a :defs AST node. For example:
class Main
def Main.main_func; end
def explain
some_func.tap do |s|
def s.inspect; self; end
end
end
end
Instance Attribute Summary
Attributes inherited from ParseNodeStruct
Class Method Summary collapse
Instance Method Summary collapse
-
#class_name ⇒ Object
class_name is specified as
nilif it should be inferred from the enclosing type. - #name ⇒ Object
- #static? ⇒ Boolean
Methods inherited from MethodParseNode
Methods inherited from ParseNode
#enclosing_type_node, from_node, #parent_node, #preceding_sibling_nodes, #public?
Class Method Details
.static?(node) ⇒ Boolean
130 131 132 |
# File 'lib/appmap/inspect/parse_node.rb', line 130 def static?(node) %i[self const].member?(node.children[0].type) end |
Instance Method Details
#class_name ⇒ Object
class_name is specified as nil if it should be inferred from the enclosing type.
141 142 143 144 145 146 147 148 149 150 |
# File 'lib/appmap/inspect/parse_node.rb', line 141 def class_name case (defs_type = node.children[0].type) when :self class_name_from_enclosing_type when :const class_name_from_declaration else raise "Unrecognized 'defs' method type : #{defs_type.inspect}" end end |
#name ⇒ Object
135 136 137 |
# File 'lib/appmap/inspect/parse_node.rb', line 135 def name node.children[1].to_s end |
#static? ⇒ Boolean
152 153 154 |
# File 'lib/appmap/inspect/parse_node.rb', line 152 def static? true end |