Class: Mutineer::Subject
- Inherits:
-
Struct
- Object
- Struct
- Mutineer::Subject
- Defined in:
- lib/mutineer/subject.rb
Overview
One discoverable method: its location, namespace context, and the live Prism::DefNode mutators walk. Struct (not Data) because def_node is a live AST node — value-equality would be hollow, so we don't promise it.
Instance Attribute Summary collapse
-
#def_node ⇒ Object
Returns the value of attribute def_node.
-
#file ⇒ Object
Returns the value of attribute file.
-
#name ⇒ Object
Returns the value of attribute name.
-
#namespace ⇒ Object
Returns the value of attribute namespace.
-
#singleton ⇒ Object
Returns the value of attribute singleton.
Instance Method Summary collapse
-
#body_loc ⇒ Object
nil for empty methods (def empty; end).
-
#qualified_name ⇒ Object
e.g.
Instance Attribute Details
#def_node ⇒ Object
Returns the value of attribute def_node
7 8 9 |
# File 'lib/mutineer/subject.rb', line 7 def def_node @def_node end |
#file ⇒ Object
Returns the value of attribute file
7 8 9 |
# File 'lib/mutineer/subject.rb', line 7 def file @file end |
#name ⇒ Object
Returns the value of attribute name
7 8 9 |
# File 'lib/mutineer/subject.rb', line 7 def name @name end |
#namespace ⇒ Object
Returns the value of attribute namespace
7 8 9 |
# File 'lib/mutineer/subject.rb', line 7 def namespace @namespace end |
#singleton ⇒ Object
Returns the value of attribute singleton
7 8 9 |
# File 'lib/mutineer/subject.rb', line 7 def singleton @singleton end |
Instance Method Details
#body_loc ⇒ Object
nil for empty methods (def empty; end).
15 16 17 |
# File 'lib/mutineer/subject.rb', line 15 def body_loc def_node.body&.location end |
#qualified_name ⇒ Object
e.g. "Billing::Invoice#total", "Billing::Invoice.build".
- Top-level (empty namespace) -> "#name" (no
prefix).
10 11 12 |
# File 'lib/mutineer/subject.rb', line 10 def qualified_name namespace.join("::") + (singleton ? "." : "#") + name.to_s end |