Class: ASTDistance::Node
- Inherits:
-
Object
- Object
- ASTDistance::Node
- Defined in:
- lib/ast_distance/node.rb
Instance Attribute Summary collapse
-
#index ⇒ Object
readonly
Returns the value of attribute index.
-
#parent_index ⇒ Object
Returns the value of attribute parent_index.
-
#type ⇒ Object
readonly
Returns the value of attribute type.
Instance Method Summary collapse
-
#initialize(index:, type:) ⇒ Node
constructor
A new instance of Node.
- #root_node? ⇒ Boolean
Constructor Details
#initialize(index:, type:) ⇒ Node
6 7 8 9 10 |
# File 'lib/ast_distance/node.rb', line 6 def initialize(index:, type:) @index = index @type = type @parent_index = nil end |
Instance Attribute Details
#index ⇒ Object (readonly)
Returns the value of attribute index.
4 5 6 |
# File 'lib/ast_distance/node.rb', line 4 def index @index end |
#parent_index ⇒ Object
Returns the value of attribute parent_index.
3 4 5 |
# File 'lib/ast_distance/node.rb', line 3 def parent_index @parent_index end |
#type ⇒ Object (readonly)
Returns the value of attribute type.
4 5 6 |
# File 'lib/ast_distance/node.rb', line 4 def type @type end |
Instance Method Details
#root_node? ⇒ Boolean
12 13 14 |
# File 'lib/ast_distance/node.rb', line 12 def root_node? parent_index.nil? end |