class Prism::SourceFileNode
Represents the use of the __FILE__ keyword.
__FILE__ ^^^^^^^^
Public Class Methods
Source
# File lib/prism/node.rb, line 22777 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 22880 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 22860 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 22854 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 22866 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 22872 def mutable? flags.anybits?(StringFlags::MUTABLE) end
mutable by virtue of a frozen_string_literal: false comment or --disable-frozen-string-literal
Node Interface
Public Class Methods
Public Instance Methods
Source
# File lib/prism/node.rb, line 22797 def accept(visitor) visitor.visit_source_file_node(self) end
See Node.accept.
Source
# File lib/prism/node.rb, line 22802 def child_nodes [] end
See Node.child_nodes.
Also aliased as: deconstruct
Source
# File lib/prism/node.rb, line 22818 def comment_targets [] #: Array[Prism::node | Location] end
See Node.comment_targets.
Source
# File lib/prism/node.rb, line 22813 def compact_child_nodes [] end
Source
# File lib/prism/node.rb, line 22826 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 22807 def each_child_node return to_enum(:each_child_node) unless block_given? end
See Node.each_child_node.