Class: Prism::ConstantPathNode
Relationships & Source Files | |
Namespace Children | |
Exceptions:
| |
Super Chains via Extension / Inclusion / Inheritance | |
Class Chain:
self,
Node
|
|
Instance Chain:
self,
Node
|
|
Inherits: |
Prism::Node
|
Defined in: | lib/prism/node_ext.rb |
Instance Method Summary
-
#full_name
Returns the full name of this constant path.
-
#full_name_parts
Returns the list of parts for the full name of this constant path.
Instance Method Details
#full_name
Returns the full name of this constant path. For example: “Foo::Bar”
# File 'lib/prism/node_ext.rb', line 129
def full_name full_name_parts.join("::") end
#full_name_parts
Returns the list of parts for the full name of this constant path. For example: [:Foo, :Bar]
# File 'lib/prism/node_ext.rb', line 112
def full_name_parts parts = [child.name] current = parent while current.is_a?(ConstantPathNode) parts.unshift(current.child.name) current = current.parent end unless current.is_a?(ConstantReadNode) raise DynamicPartsInConstantPathError, "Constant path contains dynamic parts. Cannot compute full name" end parts.unshift(current&.name || :"") end