Class: YARP::SourceEncodingNode

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

Overview

Represents the use of the ‘__ENCODING__` keyword.

__ENCODING__
^^^^^^^^^^^^

Instance Method Summary collapse

Constructor Details

#initialize(location) ⇒ SourceEncodingNode

def initialize: (location: Location) -> void



9283
9284
9285
# File 'lib/yarp/node.rb', line 9283

def initialize(location)
  @location = location
end

Instance Method Details

#accept(visitor) ⇒ Object

def accept: (visitor: Visitor) -> void



9288
9289
9290
# File 'lib/yarp/node.rb', line 9288

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

#child_nodesObject Also known as: deconstruct

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



9293
9294
9295
# File 'lib/yarp/node.rb', line 9293

def child_nodes
  []
end

#comment_targetsObject

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



9298
9299
9300
# File 'lib/yarp/node.rb', line 9298

def comment_targets
  []
end

#copy(**params) ⇒ Object

def copy: (**params) -> SourceEncodingNode



9303
9304
9305
9306
9307
# File 'lib/yarp/node.rb', line 9303

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

#deconstruct_keys(keys) ⇒ Object

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



9313
9314
9315
# File 'lib/yarp/node.rb', line 9313

def deconstruct_keys(keys)
  { location: location }
end

#inspect(inspector = NodeInspector.new) ⇒ Object



9317
9318
9319
9320
# File 'lib/yarp/node.rb', line 9317

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