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.



6774
6775
6776
6777
6778
6779
# File 'lib/prism/node.rb', line 6774

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`.



6825
6826
6827
# File 'lib/prism/node.rb', line 6825

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.



6831
6832
6833
# File 'lib/prism/node.rb', line 6831

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

#accept(visitor) ⇒ Object

def accept: (Visitor visitor) -> void



6782
6783
6784
# File 'lib/prism/node.rb', line 6782

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

#child_nodesObject Also known as: deconstruct

def child_nodes: () -> Array



6787
6788
6789
# File 'lib/prism/node.rb', line 6787

def child_nodes
  []
end

#comment_targetsObject

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



6797
6798
6799
# File 'lib/prism/node.rb', line 6797

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

#compact_child_nodesObject

def compact_child_nodes: () -> Array



6792
6793
6794
# File 'lib/prism/node.rb', line 6792

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



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

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 }



6810
6811
6812
# File 'lib/prism/node.rb', line 6810

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

#inspectObject

def inspect -> String



6815
6816
6817
# File 'lib/prism/node.rb', line 6815

def inspect
  InspectVisitor.compose(self)
end

#typeObject

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



6820
6821
6822
# File 'lib/prism/node.rb', line 6820

def type
  :false_node
end