class Unparser::Writer::Regexp

Writer for regexp literals

def dispatch

def dispatch
  effective_writer.write_to_buffer
end

def effective_writer

mutant:disable
def effective_writer
  CANDIDATES.each do |token_open, token_close|
    source = render_with_delimiter(token_close:, token_open:)
    next unless round_trips?(source:)
    return writer_with(Effective, node:, token_close:, token_open:)
  end
  fail 'Could not find a round tripping solution for regexp'
end

def render_with_delimiter(token_close:, token_open:)

mutant:disable
def render_with_delimiter(token_close:, token_open:)
  buffer = Buffer.new
  writer = Effective.new(
    buffer:,
    comments:,
    explicit_encoding:,
    local_variable_scope:,
    node:,
    token_close:,
    token_open:
  )
  writer.dispatch
  buffer.nl_flush_heredocs
  buffer.content
end