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.



5893
5894
5895
5896
5897
5898
# File 'lib/prism/node.rb', line 5893

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



5944
5945
5946
# File 'lib/prism/node.rb', line 5944

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.



5950
5951
5952
# File 'lib/prism/node.rb', line 5950

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

#accept(visitor) ⇒ Object

def accept: (Visitor visitor) -> void



5901
5902
5903
# File 'lib/prism/node.rb', line 5901

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

#child_nodesObject Also known as: deconstruct

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



5906
5907
5908
# File 'lib/prism/node.rb', line 5906

def child_nodes
  []
end

#comment_targetsObject

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



5916
5917
5918
# File 'lib/prism/node.rb', line 5916

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

#compact_child_nodesObject

def compact_child_nodes: () -> Array



5911
5912
5913
# File 'lib/prism/node.rb', line 5911

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



5921
5922
5923
# File 'lib/prism/node.rb', line 5921

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 }



5929
5930
5931
# File 'lib/prism/node.rb', line 5929

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

#inspectObject

def inspect -> String



5934
5935
5936
# File 'lib/prism/node.rb', line 5934

def inspect
  InspectVisitor.compose(self)
end

#typeObject

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



5939
5940
5941
# File 'lib/prism/node.rb', line 5939

def type
  :false_node
end