class Rigor::ModuleGraph::Node
A piece of node metadata extracted from a source file.
Three flavours, distinguished by +kind+:
-
+class+ / +module+ β a constant declaration. Carries +name+, +path+, +line+, +column+. +owner+/+visibility+/ +access+ are nil.
-
+instance_method+ / +class_method+ β a method definition. Carries +name+, +owner+ (the enclosing class/module), +visibility+, +path+, +line+, +column+.
-
+attribute+ β an +attr_reader+ / +attr_writer+ / +attr_accessor+ symbol. Carries +name+, +owner+, +visibility+, +access+, +path+, +line+, +column+.
Constants
- ACCESSES
- KINDS
- VISIBILITIES
Public Class Methods
Source
# File lib/rigor/module_graph/node.rb, line 44 def self.build(kind:, name:, owner: nil, path: nil, line: nil, column: nil, visibility: nil, access: nil) new( kind: validate_kind!(kind), name: name.to_s.freeze, owner: owner && owner.to_s.freeze, path: path, line: line, column: column, visibility: visibility && validate_visibility!(visibility), access: access && validate_access!(access) ) end
Public Instance Methods
Source
# File lib/rigor/module_graph/node.rb, line 104 def dedup_key [kind, owner, name] end
Key used to dedupe node rows. Two declarations of the same method on the same owner collapse to one row; class re-opens collapse to one class node.
Source
# File lib/rigor/module_graph/node.rb, line 79 def to_h h = { "kind" => kind, "name" => name } h["owner"] = owner if owner h["path"] = path if path h["line"] = line if line h["column"] = column if column h["visibility"] = visibility if visibility h["access"] = access if access h end
Source
# File lib/rigor/module_graph/node.rb, line 93 def to_message_payload h = { "kind" => kind, "name" => name } h["owner"] = owner if owner h["visibility"] = visibility if visibility h["access"] = access if access h end
The payload embedded in the pluginβs +:info+ diagnostic message. Position is intentionally absent β the diagnostic row carries +path+/+line+/+column+ on its own.