Class: Prism::FalseNode

Inherits:
PrismNode
  • Object
show all
Defined in:
lib/prism/node.rb,
ext/prism/api_node.c

Overview

Represents the use of the literal ‘false` keyword.

false
^^^^^

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(source, node_id, location, flags) ⇒ FalseNode

Initialize a new FalseNode node.



6744
6745
6746
6747
6748
6749
# File 'lib/prism/node.rb', line 6744

def initialize(source, node_id, location, flags)
  @source = source
  @node_id = node_id
  @location = location
  @flags = flags
end

Class Method Details

.typeObject

Return a symbol representation of this node type. See ‘Node::type`.



6795
6796
6797
# File 'lib/prism/node.rb', line 6795

def self.type
  :false_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.



6801
6802
6803
# File 'lib/prism/node.rb', line 6801

def ===(other)
  other.is_a?(FalseNode)
end

#accept(visitor) ⇒ Object

def accept: (Visitor visitor) -> void



6752
6753
6754
# File 'lib/prism/node.rb', line 6752

def accept(visitor)
  visitor.visit_false_node(self)
end

#child_nodesObject Also known as: deconstruct

def child_nodes: () -> Array[nil | Node]



6757
6758
6759
# File 'lib/prism/node.rb', line 6757

def child_nodes
  []
end

#comment_targetsObject

def comment_targets: () -> Array[Node | Location]



6767
6768
6769
# File 'lib/prism/node.rb', line 6767

def comment_targets
  [] #: Array[Prism::node | Location]
end

#compact_child_nodesObject

def compact_child_nodes: () -> Array



6762
6763
6764
# File 'lib/prism/node.rb', line 6762

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) -> FalseNode



6772
6773
6774
# File 'lib/prism/node.rb', line 6772

def copy(node_id: self.node_id, location: self.location, flags: self.flags)
  FalseNode.new(source, node_id, location, flags)
end

#deconstruct_keys(keys) ⇒ Object

def deconstruct_keys: (Array keys) -> { node_id: Integer, location: Location }



6780
6781
6782
# File 'lib/prism/node.rb', line 6780

def deconstruct_keys(keys)
  { node_id: node_id, location: location }
end

#inspectObject

def inspect -> String



6785
6786
6787
# File 'lib/prism/node.rb', line 6785

def inspect
  InspectVisitor.compose(self)
end

#typeObject

Return a symbol representation of this node type. See ‘Node#type`.



6790
6791
6792
# File 'lib/prism/node.rb', line 6790

def type
  :false_node
end