class Unparser::Writer::Resbody

Writer for rescue bodies

def emit_assignment

def emit_assignment
  return unless assignment
  write(' => ')
  case assignment.type
  when :send, :csend
    write_send_assignment
  when :indexasgn
    write_index_assignment
  else
    visit(assignment)
  end
end

def emit_exception

def emit_exception
  return unless exception
  ws
  delimited(exception.children)
end

def emit_postcontrol

def emit_postcontrol
  if body
    write(' rescue ')
    visit(body)
  else
    nl
    write('rescue')
  end
end

def emit_regular

def emit_regular
  write('rescue')
  emit_exception
  emit_assignment
  emit_optional_body(body)
end

def write_index_assignment

def write_index_assignment
  receiver, *indexes = assignment.children
  visit(receiver)
  write('[')
  delimited(indexes)
  write(']')
end

def write_send_assignment

def write_send_assignment
  details = NodeDetails::Send.new(assignment)
  visit(details.receiver)
  write(OPERATORS.fetch(assignment.type))
  write(details.non_assignment_selector)
end