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



5613
5614
5615
5616
# File 'lib/yarp/node.rb', line 5613

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

Instance Attribute Details

#filepathObject (readonly)

attr_reader filepath: String



5610
5611
5612
# File 'lib/yarp/node.rb', line 5610

def filepath
  @filepath
end

Instance Method Details

#accept(visitor) ⇒ Object

def accept: (visitor: Visitor) -> void



5619
5620
5621
# File 'lib/yarp/node.rb', line 5619

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

#child_nodesObject Also known as: deconstruct

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



5624
5625
5626
# File 'lib/yarp/node.rb', line 5624

def child_nodes
  []
end

#deconstruct_keys(keys) ⇒ Object

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



5632
5633
5634
# File 'lib/yarp/node.rb', line 5632

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