class Prism::SourceFileNode
Represents the use of the __FILE__ keyword.
__FILE__ ^^^^^^^^
Public Class Methods
Source
# File lib/prism/node.rb, line 22778 def initialize(source, node_id, location, flags, filepath) @source = source @node_id = node_id @location = location @flags = flags @filepath = filepath end
Initialize a new SourceFileNode node.
Public Instance Methods
Source
# File lib/prism/node.rb, line 22881 def filepath @filepath end
Represents the file path being parsed. This corresponds directly to the filepath option given to the various Prism.parse* APIs.
Flags
Public Instance Methods
Source
# File lib/prism/node.rb, line 22861 def forced_binary_encoding? flags.anybits?(StringFlags::FORCED_BINARY_ENCODING) end
internal bytes forced the encoding to binary
Source
# File lib/prism/node.rb, line 22855 def forced_utf8_encoding? flags.anybits?(StringFlags::FORCED_UTF8_ENCODING) end
internal bytes forced the encoding to UTF-8
Source
# File lib/prism/node.rb, line 22867 def frozen? flags.anybits?(StringFlags::FROZEN) end
frozen by virtue of a frozen_string_literal: true comment or --enable-frozen-string-literal
Source
# File lib/prism/node.rb, line 22873 def mutable? flags.anybits?(StringFlags::MUTABLE) end
mutable by virtue of a frozen_string_literal: false comment or --disable-frozen-string-literal
Node Interface
These methods are present on all subclasses of Node. Read the node interface docs for more information.
Public Class Methods
Public Instance Methods
Source
# File lib/prism/node.rb, line 22798 def accept(visitor) visitor.visit_source_file_node(self) end
See Node.accept.
Source
# File lib/prism/node.rb, line 22803 def child_nodes [] end
See Node.child_nodes.
Source
# File lib/prism/node.rb, line 22819 def comment_targets [] #: Array[Prism::node | Location] end
See Node.comment_targets.
Source
# File lib/prism/node.rb, line 22814 def compact_child_nodes [] end
Source
# File lib/prism/node.rb, line 22827 def copy(node_id: self.node_id, location: self.location, flags: self.flags, filepath: self.filepath) SourceFileNode.new(source, node_id, location, flags, filepath) end
Creates a copy of self with the given fields, using self as the template.
Source
# File lib/prism/node.rb, line 22808 def each_child_node return to_enum(:each_child_node) unless block_given? end
See Node.each_child_node.
Repository
Methods related to Relocation.