Class: Prism::TrueNode
- Inherits:
-
PrismNode
- Object
- PrismNode
- Prism::TrueNode
- Defined in:
- lib/prism/node.rb,
ext/prism/api_node.c
Overview
Represents the use of the literal true keyword.
true
^^^^
Class Method Summary collapse
-
.type ⇒ Object
Return a symbol representation of this node type.
Instance Method Summary collapse
-
#===(other) ⇒ Object
Implements case-equality for the node.
-
#accept(visitor) ⇒ Object
def accept: (Visitor visitor) -> void.
-
#child_nodes ⇒ Object
(also: #deconstruct)
def child_nodes: () -> Array.
-
#comment_targets ⇒ Object
def comment_targets: () -> Array[Node | Location].
-
#compact_child_nodes ⇒ Object
def compact_child_nodes: () -> Array.
-
#copy(node_id: self.node_id, location: self.location, flags: self.flags) ⇒ Object
def copy: (?node_id: Integer, ?location: Location, ?flags: Integer) -> TrueNode.
-
#deconstruct_keys(keys) ⇒ Object
def deconstruct_keys: (Array keys) -> { node_id: Integer, location: Location }.
-
#each_child_node ⇒ Object
def each_child_node: () { (Prism::node) -> void } -> void | () -> Enumerator.
-
#initialize(source, node_id, location, flags) ⇒ TrueNode
constructor
Initialize a new TrueNode node.
-
#inspect ⇒ Object
def inspect -> String.
-
#type ⇒ Object
Return a symbol representation of this node type.
Constructor Details
#initialize(source, node_id, location, flags) ⇒ TrueNode
Initialize a new TrueNode node.
18632 18633 18634 18635 18636 18637 |
# File 'lib/prism/node.rb', line 18632 def initialize(source, node_id, location, flags) @source = source @node_id = node_id @location = location @flags = flags end |
Class Method Details
.type ⇒ Object
Return a symbol representation of this node type. See Node::type.
18689 18690 18691 |
# File 'lib/prism/node.rb', line 18689 def self.type :true_node end |
Instance Method Details
#===(other) ⇒ Object
Implements case-equality for the node. This is effectively == but without comparing the value of locations. Locations are checked only for presence.
18695 18696 18697 |
# File 'lib/prism/node.rb', line 18695 def ===(other) other.is_a?(TrueNode) end |
#accept(visitor) ⇒ Object
def accept: (Visitor visitor) -> void
18640 18641 18642 |
# File 'lib/prism/node.rb', line 18640 def accept(visitor) visitor.visit_true_node(self) end |
#child_nodes ⇒ Object Also known as: deconstruct
def child_nodes: () -> Array
18645 18646 18647 |
# File 'lib/prism/node.rb', line 18645 def child_nodes [] end |
#comment_targets ⇒ Object
def comment_targets: () -> Array[Node | Location]
18661 18662 18663 |
# File 'lib/prism/node.rb', line 18661 def comment_targets [] #: Array[Prism::node | Location] end |
#compact_child_nodes ⇒ Object
def compact_child_nodes: () -> Array
18656 18657 18658 |
# File 'lib/prism/node.rb', line 18656 def compact_child_nodes [] end |
#copy(node_id: self.node_id, location: self.location, flags: self.flags) ⇒ Object
def copy: (?node_id: Integer, ?location: Location, ?flags: Integer) -> TrueNode
18666 18667 18668 |
# File 'lib/prism/node.rb', line 18666 def copy(node_id: self.node_id, location: self.location, flags: self.flags) TrueNode.new(source, node_id, location, flags) end |
#deconstruct_keys(keys) ⇒ Object
def deconstruct_keys: (Array keys) -> { node_id: Integer, location: Location }
18674 18675 18676 |
# File 'lib/prism/node.rb', line 18674 def deconstruct_keys(keys) { node_id: node_id, location: location } end |
#each_child_node ⇒ Object
def each_child_node: () { (Prism::node) -> void } -> void | () -> Enumerator
18650 18651 18652 18653 |
# File 'lib/prism/node.rb', line 18650 def each_child_node return to_enum(:each_child_node) unless block_given? end |
#inspect ⇒ Object
def inspect -> String
18679 18680 18681 |
# File 'lib/prism/node.rb', line 18679 def inspect InspectVisitor.compose(self) end |
#type ⇒ Object
Return a symbol representation of this node type. See ‘Node#type`.
18684 18685 18686 |
# File 'lib/prism/node.rb', line 18684 def type :true_node end |