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.



7195
7196
7197
7198
7199
7200
# File 'lib/prism/node.rb', line 7195

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.



7252
7253
7254
# File 'lib/prism/node.rb', line 7252

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.



7258
7259
7260
# File 'lib/prism/node.rb', line 7258

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

#accept(visitor) ⇒ Object

def accept: (Visitor visitor) -> void



7203
7204
7205
# File 'lib/prism/node.rb', line 7203

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

#child_nodesObject Also known as: deconstruct

def child_nodes: () -> Array



7208
7209
7210
# File 'lib/prism/node.rb', line 7208

def child_nodes
  []
end

#comment_targetsObject

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



7224
7225
7226
# File 'lib/prism/node.rb', line 7224

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

#compact_child_nodesObject

def compact_child_nodes: () -> Array



7219
7220
7221
# File 'lib/prism/node.rb', line 7219

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



7229
7230
7231
# File 'lib/prism/node.rb', line 7229

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 }



7237
7238
7239
# File 'lib/prism/node.rb', line 7237

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

#each_child_nodeObject

def each_child_node: () { (Prism::node) -> void } -> void | () -> Enumerator



7213
7214
7215
7216
# File 'lib/prism/node.rb', line 7213

def each_child_node
  return to_enum(:each_child_node) unless block_given?

end

#inspectObject

def inspect -> String



7242
7243
7244
# File 'lib/prism/node.rb', line 7242

def inspect
  InspectVisitor.compose(self)
end

#typeObject

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



7247
7248
7249
# File 'lib/prism/node.rb', line 7247

def type
  :false_node
end