class SyntaxTree::StringContent

Experimental RBS support (using type sampling data from the type_fusion project).

# sig/syntax_tree/node.rbs

class SyntaxTree::StringContent < SyntaxTree::Node
  def initialize: (parts: (Array[] | Array[SyntaxTree::StringEmbExpr] | Array[SyntaxTree::TStringContent]), location: SyntaxTree::Location) -> void
end


“string”
StringContent represents the contents of a string-like value.

def ===(other)

def ===(other)
  other.is_a?(StringContent) && ArrayMatch.call(parts, other.parts)
end

def accept(visitor)

def accept(visitor)
  visitor.visit_string_content(self)
end

def child_nodes

def child_nodes
  parts
end

def copy(parts: nil, location: nil)

def copy(parts: nil, location: nil)
  StringContent.new(
    parts: parts || self.parts,
    location: location || self.location
  )
end

def deconstruct_keys(_keys)

def deconstruct_keys(_keys)
  { parts: parts, location: location }
end

def format(q)

def format(q)
  q.text(q.quote)
  q.group do
    parts.each do |part|
      if part.is_a?(TStringContent)
        value = Quotes.normalize(part.value, q.quote)
        first = true
        value.each_line(chomp: true) do |line|
          if first
            first = false
          else
            q.breakable_return
          end
          q.text(line)
        end
        q.breakable_return if value.end_with?("\n")
      else
        q.format(part)
      end
    end
  end
  q.text(q.quote)
end

def initialize(parts:, location:)

Experimental RBS support (using type sampling data from the type_fusion project).

def initialize: (parts: ( | SyntaxTree::StringEmbExpr | SyntaxTree::StringEmbExpr | SyntaxTree::TStringContent | SyntaxTree::TStringContent | SyntaxTree::StringEmbExpr | SyntaxTree::TStringContent | SyntaxTree::TStringContent | SyntaxTree::TStringContent | SyntaxTree::TStringContent), location: SyntaxTree::Location) -> void

This signature was generated using 33 samples from 1 application.

def initialize(parts:, location:)
  @parts = parts
  @location = location
  @comments = []
end