Class: YARP::SourceFileNode

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

Overview

Represents the use of the ‘__FILE__` keyword.

__FILE__
^^^^^^^^

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(filepath, location) ⇒ SourceFileNode

def initialize: (filepath: String, location: Location) -> void



5566
5567
5568
5569
# File 'lib/yarp/node.rb', line 5566

def initialize(filepath, location)
  @filepath = filepath
  @location = location
end

Instance Attribute Details

#filepathObject (readonly)

attr_reader filepath: String



5563
5564
5565
# File 'lib/yarp/node.rb', line 5563

def filepath
  @filepath
end

Instance Method Details

#accept(visitor) ⇒ Object

def accept: (visitor: Visitor) -> void



5572
5573
5574
# File 'lib/yarp/node.rb', line 5572

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

#child_nodesObject Also known as: deconstruct

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



5578
5579
5580
# File 'lib/yarp/node.rb', line 5578

def child_nodes
  []
end

#deconstruct_keys(keys) ⇒ Object

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



5586
5587
5588
# File 'lib/yarp/node.rb', line 5586

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