def recreate_method(method, advices, scope)
      context.instance_variable_set(:@aspector_creating_method, true)

      raw_advices = advices.select(&:raw?)

      if raw_advices.size > 0
        raw_advices.each do |advice|
          if @target.is_a?(Module) && !@options[:class_methods]
            @target.class_exec method, self, &advice.advice_block
          else
            @target.instance_exec method, self, &advice.advice_block
          end
        end

        return if raw_advices.size == advices.size
      end

      begin
        @wrapped_methods[method] = context.instance_method(method)
      rescue
        # ignore undefined method error
        if @options[:existing_methods_only]
          logger.log Logging::WARN, 'method-not-found', method
        end

        return
      end

      before_advices = advices.select(&:before?) + advices.select(&:before_filter?)
      after_advices  = advices.select(&:after?)
      around_advices = advices.select(&:around?)

      (around_advices.size - 1).downto(1) do |i|
        advice = around_advices[i]
        recreate_method_with_advices method, [], [], advice
      end

      recreate_method_with_advices(
        method,
        before_advices,
        after_advices,
        around_advices.first
      )

      context.send scope, method if scope != :public
    ensure
      context.send :remove_instance_variable, :@aspector_creating_method
    end
def recreate_method(method, advices, scope)
      context.instance_variable_set(:@aspector_creating_method, true)

      raw_advices = advices.select(&:raw?)

      if raw_advices.size > 0
        raw_advices.each do |advice|
          if @target.is_a?(Module) && !@options[:class_methods]
            @target.class_exec method, self, &advice.advice_block
          else
            @target.instance_exec method, self, &advice.advice_block
          end
        end

        return if raw_advices.size == advices.size
      end

      begin
        @wrapped_methods[method] = context.instance_method(method)
      rescue
        # ignore undefined method error
        if @options[:existing_methods_only]
          logger.log Logging::WARN, 'method-not-found', method
        end

        return
      end

      before_advices = advices.select(&:before?) + advices.select(&:before_filter?)
      after_advices  = advices.select(&:after?)
      around_advices = advices.select(&:around?)

      (around_advices.size - 1).downto(1) do |i|
        advice = around_advices[i]
        recreate_method_with_advices method, [], [], advice
      end

      recreate_method_with_advices(
        method,
        before_advices,
        after_advices,
        around_advices.first
      )

      context.send scope, method if scope != :public
    ensure
      context.send :remove_instance_variable, :@aspector_creating_method
    end
Recreates a given method applying all the advices one by one
 @param method [String] method name of a method that we want to recreate
 @param advices [Array<Aspector::Advice>] all the advices that
   should be applied (after filtering)
 @param scope [Symbol] method visibility (private, protected, public)