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.



5856
5857
5858
5859
5860
5861
# File 'lib/prism/node.rb', line 5856

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



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

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.



5913
5914
5915
# File 'lib/prism/node.rb', line 5913

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

#accept(visitor) ⇒ Object

def accept: (Visitor visitor) -> void



5864
5865
5866
# File 'lib/prism/node.rb', line 5864

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

#child_nodesObject Also known as: deconstruct

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



5869
5870
5871
# File 'lib/prism/node.rb', line 5869

def child_nodes
  []
end

#comment_targetsObject

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



5879
5880
5881
# File 'lib/prism/node.rb', line 5879

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

#compact_child_nodesObject

def compact_child_nodes: () -> Array



5874
5875
5876
# File 'lib/prism/node.rb', line 5874

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



5884
5885
5886
# File 'lib/prism/node.rb', line 5884

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 }



5892
5893
5894
# File 'lib/prism/node.rb', line 5892

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

#inspectObject

def inspect -> String



5897
5898
5899
# File 'lib/prism/node.rb', line 5897

def inspect
  InspectVisitor.compose(self)
end

#typeObject

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



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

def type
  :false_node
end