class SyntaxTree::Heredoc
Experimental RBS support (using type sampling data from the type_fusion
project).
# sig/syntax_tree/node.rbs class SyntaxTree::Heredoc < SyntaxTree::Node def initialize: (beginning: SyntaxTree::HeredocBeg, location: SyntaxTree::Location, ending: SyntaxTree::HeredocEnd, dedent: Integer, parts: Array[]) -> void end
DOC
contents
<<~DOC
Heredoc represents a heredoc string literal.
def ===(other)
def ===(other) other.is_a?(Heredoc) && beginning === other.beginning && ending === other.ending && ArrayMatch.call(parts, other.parts) end
def accept(visitor)
def accept(visitor) visitor.visit_heredoc(self) end
def child_nodes
def child_nodes [beginning, *parts, ending] end
def copy(beginning: nil, location: nil, ending: nil, parts: nil)
def copy(beginning: nil, location: nil, ending: nil, parts: nil) node = Heredoc.new( beginning: beginning || self.beginning, location: location || self.location, ending: ending || self.ending, parts: parts || self.parts ) node.comments.concat(comments.map(&:copy)) node end
def deconstruct_keys(_keys)
def deconstruct_keys(_keys) { beginning: beginning, location: location, ending: ending, parts: parts, comments: comments } end
def format(q)
def format(q) q.group do q.format(beginning) q.line_suffix(priority: Formatter::HEREDOC_PRIORITY) do q.group do q.target << SEPARATOR parts.each do |part| if part.is_a?(TStringContent) value = part.value first = true value.each_line(chomp: true) do |line| if first first = false else q.target << SEPARATOR end q.text(line) end q.target << SEPARATOR if value.end_with?("\n") else q.format(part) end end q.format(ending) end end end end
def initialize(beginning:, location:, ending: nil, dedent: 0, parts: [])
Experimental RBS support (using type sampling data from the type_fusion
project).
def initialize: (beginning: SyntaxTree::HeredocBeg, location: SyntaxTree::Location, ending: SyntaxTree::HeredocEnd, dedent: Integer, parts: ) -> void
This signature was generated using 1 sample from 1 application.
def initialize(beginning:, location:, ending: nil, dedent: 0, parts: []) @beginning = beginning @ending = ending @dedent = dedent @parts = parts @location = location @comments = [] end