Class: YARP::TrueNode

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

Overview

Represents the use of the literal ‘true` keyword.

true
^^^^

Instance Method Summary collapse

Constructor Details

#initialize(location) ⇒ TrueNode

def initialize: (location: Location) -> void



9891
9892
9893
# File 'lib/yarp/node.rb', line 9891

def initialize(location)
  @location = location
end

Instance Method Details

#accept(visitor) ⇒ Object

def accept: (visitor: Visitor) -> void



9896
9897
9898
# File 'lib/yarp/node.rb', line 9896

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

#child_nodesObject Also known as: deconstruct

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



9901
9902
9903
# File 'lib/yarp/node.rb', line 9901

def child_nodes
  []
end

#comment_targetsObject

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



9906
9907
9908
# File 'lib/yarp/node.rb', line 9906

def comment_targets
  []
end

#copy(**params) ⇒ Object

def copy: (**params) -> TrueNode



9911
9912
9913
9914
9915
# File 'lib/yarp/node.rb', line 9911

def copy(**params)
  TrueNode.new(
    params.fetch(:location) { location },
  )
end

#deconstruct_keys(keys) ⇒ Object

def deconstruct_keys: (keys: Array) -> Hash[Symbol, nil | Node | Array | String | Token | Array | Location]



9921
9922
9923
# File 'lib/yarp/node.rb', line 9921

def deconstruct_keys(keys)
  { location: location }
end

#inspect(inspector = NodeInspector.new) ⇒ Object



9925
9926
9927
9928
# File 'lib/yarp/node.rb', line 9925

def inspect(inspector = NodeInspector.new)
  inspector << inspector.header(self)
  inspector.to_str
end