class Rufo::Formatter

def adjust_visibility_indent(node, base_column)

def adjust_visibility_indent(node, base_column)
  return if @visibility_indent == :align
  case node[1]
  when "private", "protected", "public"
    # OK
  else
    return
  end
  i = @tokens.size - 1
  # First, skip spaces until a newline or comment
  while i >= 0
    token = @tokens[i]
    case token[1]
    when :on_sp
      i -= 1
      next
    when :on_nl, :on_ignored_nl, :on_comment
      i -= 1
      break
    else
      return
    end
  end
  if @visibility_indent_in_action[@current_type]
    last_newline_index = @output.rindex("\n")
    if last_newline_index
      # Remove extra indent if we are indenting inside private/protected/public
      # and we just found another one.
      @output = "#{@output[0..last_newline_index]}#{@output[last_newline_index + 1 + @indent_size..-1]}".dup
      @indent -= @indent_size
      @visibility_indent_in_action.delete @current_type
    end
  end
  # Now we skip all spaces and newlines
  while i >= 0
    token = @tokens[i]
    case token[1]
    when :on_sp, :on_nl, :on_ignored_nl
      i -= 1
      next
    else
      break
    end
  end
  return if i < 0
  if @visibility_indent == :indent || base_column + @indent_size == @tokens[i][0][1]
    @indent += @indent_size
    @visibility_indent_in_action[@current_type] = true
  end
end