def process
      file_pattern = File.join(Configuration.instance.get(:path), @file_pattern)
      Dir.glob(file_pattern).each do |file_path|
        unless Configuration.instance.get(:skip_files).include? file_path
          begin
            conflict_actions = []
            source = self.class.file_source(file_path)
            ast = self.class.file_ast(file_path)

            @current_file = file_path

            self.process_with_node ast do
              begin
                instance_eval &@block
              rescue NoMethodError
                puts @current_node.debug_info
                raise
              end
            end

            if @actions.length > 0
              @actions.sort_by! { |action| action.send(@options[:sort_by]) }
              conflict_actions = get_conflict_actions
              @actions.reverse.each do |action|
                source[action.begin_pos...action.end_pos] = action.rewritten_code
                source = remove_code_or_whole_line(source, action.line)
              end
              @actions = []

              self.class.write_file(file_path, source)
            end
          rescue Parser::SyntaxError
            puts "[Warn] file #{file_path} was not parsed correctly."
            # do nothing, iterate next file
          end while !conflict_actions.empty?
        end
      end
    end
def process
      file_pattern = File.join(Configuration.instance.get(:path), @file_pattern)
      Dir.glob(file_pattern).each do |file_path|
        unless Configuration.instance.get(:skip_files).include? file_path
          begin
            conflict_actions = []
            source = self.class.file_source(file_path)
            ast = self.class.file_ast(file_path)

            @current_file = file_path

            self.process_with_node ast do
              begin
                instance_eval &@block
              rescue NoMethodError
                puts @current_node.debug_info
                raise
              end
            end

            if @actions.length > 0
              @actions.sort_by! { |action| action.send(@options[:sort_by]) }
              conflict_actions = get_conflict_actions
              @actions.reverse.each do |action|
                source[action.begin_pos...action.end_pos] = action.rewritten_code
                source = remove_code_or_whole_line(source, action.line)
              end
              @actions = []

              self.class.write_file(file_path, source)
            end
          rescue Parser::SyntaxError
            puts "[Warn] file #{file_path} was not parsed correctly."
            # do nothing, iterate next file
          end while !conflict_actions.empty?
        end
      end
    end
Initialize an instance.

 @param rewriter [Synvert::Core::Rewriter]
 @param file_pattern [String] pattern to find files, e.g. spec/**/*_spec.rb
 @param options [Hash] instance options, it includes :sort_by.
 @param block [Block] block code to find nodes, match conditions and rewrite code.
 @return [Synvert::Core::Rewriter::Instance]
 Process the instance.
 It finds all files, for each file, it executes the block code, gets all rewrite actions,
 and rewrite source code back to original file.