class SyntaxTree::Word
node.
In the example above, there would be two Word nodes within a parent Words
%W[a#{b}c xyz]
interpolation.
Word represents an element within a special array literal that accepts
def ===(other)
def ===(other) other.is_a?(Word) && ArrayMatch.call(parts, other.parts) end
def accept(visitor)
def accept(visitor) visitor.visit_word(self) end
def child_nodes
def child_nodes parts end
def copy(parts: nil, location: nil)
def copy(parts: nil, location: nil) node = Word.new( parts: parts || self.parts, location: location || self.location ) node.comments.concat(comments.map(&:copy)) node end
def deconstruct_keys(_keys)
def deconstruct_keys(_keys) { parts: parts, location: location, comments: comments } end
def format(q)
def format(q) q.format_each(parts) end
def initialize(parts:, location:)
def initialize(parts:, location:) @parts = parts @location = location @comments = [] end
def match?(pattern)
def match?(pattern) parts.any? { |part| part.is_a?(TStringContent) && part.match?(pattern) } end