Class: Prettyrb::Nodes::BaseNode
- Inherits:
-
Parser::AST::Node
- Object
- Parser::AST::Node
- Prettyrb::Nodes::BaseNode
show all
- Defined in:
- lib/prettyrb/nodes/base_node.rb
Instance Method Summary
collapse
Constructor Details
#initialize(type, children, properties) ⇒ BaseNode
Returns a new instance of BaseNode.
6
7
8
9
10
11
12
13
14
15
16
17
|
# File 'lib/prettyrb/nodes/base_node.rb', line 6
def initialize(type, children, properties)
@mutable = {}
super
children&.each do |child|
next unless child.is_a?(BaseNode)
child.parent = self
end
self
end
|
Instance Method Details
#parent ⇒ Object
19
20
21
|
# File 'lib/prettyrb/nodes/base_node.rb', line 19
def parent
@mutable[:parent]
end
|
#string? ⇒ Boolean
23
24
25
|
# File 'lib/prettyrb/nodes/base_node.rb', line 23
def string?
type == :str || type == :dstr
end
|