class SyntaxTree::HeredocBeg

HeredocBeg represents the beginning declaration of a heredoc.

<<~DOC
  contents
DOC

In the example above the HeredocBeg node represents <<~DOC.

Attributes

comments[R]
Array[ Comment | EmbDoc ]

the comments attached to this node

value[R]
String

the opening declaration of the heredoc

Public Class Methods

new(value:, location:) click to toggle source
# File lib/syntax_tree/node.rb, line 5893
def initialize(value:, location:)
  @value = value
  @location = location
  @comments = []
end

Public Instance Methods

===(other) click to toggle source
# File lib/syntax_tree/node.rb, line 5928
def ===(other)
  other.is_a?(HeredocBeg) && value === other.value
end
accept(visitor) click to toggle source
# File lib/syntax_tree/node.rb, line 5899
def accept(visitor)
  visitor.visit_heredoc_beg(self)
end
child_nodes() click to toggle source
# File lib/syntax_tree/node.rb, line 5903
def child_nodes
  []
end
Also aliased as: deconstruct
copy(value: nil, location: nil) click to toggle source
# File lib/syntax_tree/node.rb, line 5907
def copy(value: nil, location: nil)
  node =
    HeredocBeg.new(
      value: value || self.value,
      location: location || self.location
    )

  node.comments.concat(comments.map(&:copy))
  node
end
deconstruct()
Alias for: child_nodes
deconstruct_keys(_keys) click to toggle source
# File lib/syntax_tree/node.rb, line 5920
def deconstruct_keys(_keys)
  { value: value, location: location, comments: comments }
end
format(q) click to toggle source
# File lib/syntax_tree/node.rb, line 5924
def format(q)
  q.text(value)
end