You are an expert in writing code in many different languages. Your goal is to perform code completion for the following code, keeping in mind the rest of the code and the file meta data.
    Metadata details:
    filename: check_validation.rb
    path of file: ./repos/powerstation/powerstation/IDE_plugin/src/main/resources/static-analyzer/controller_model_analysis
    
    the code of the file until where you have to start completion: def check_validations
	@last_v_stacktop = nil
	$node_list.each do |n|
		if n.getInValidation and n.isQuery?
			@blank = ""
			for i in 0...n.getValidationStack.length
				@blank += "  "

    
def check_validations
	@last_v_stacktop = nil
	$node_list.each do |n|
		if n.getInValidation and n.isQuery?
			@blank = ""
			for i in 0...n.getValidationStack.length
				@blank += "  "
			end
			trigger = n.getValidationStack[-1]

			if @last_v_stacktop == nil
				@last_v_stacktop = n.getValidationStack[-1]
				$graph_file.write("#{@blank}Validation for #{trigger.getIndex}(#{trigger.getInstr.getResolvedCaller}) #{trigger.getInstr.toString2}:\n")
			elsif @last_v_stacktop != n.getValidationStack[-1]
				@last_v_stacktop = n.getValidationStack[-1]
				$graph_file.write("\n")
				$graph_file.write("#{@blank}Validation for #{trigger.getIndex}(#{trigger.getInstr.getResolvedCaller}) #{trigger.getInstr.toString2}:\n")
			else
			end