<commit_before>require 'delegate'

module SitePrism
  module Vcr
    class Element < SimpleDelegator
      def initialize(element, parent, options = {})
        super element

        @parent, @options = parent, options

        @fixtures_handler = FixturesHandler.new options
        @waiter           = Waiter.new parent, options
      end

      def click_and_apply_vcr(*args, &block)
        if block_given?
          @adjuster = FixturesAdjuster.new @fixtures_handler, @options

          adjust_fixtures &block

          @waiter.waiter = @adjuster.waiter
        else
          @fixtures_handler.apply *args
        end

        self.click

        @waiter.wait
      end

      protected
        def adjust_fixtures(&block)
          @adjuster.instance_eval &block
          @adjuster.modify_fixtures
        end
    end
  end
end<commit_msg>moved code for adjusting fixtures into protected method<commit_after>require 'delegate'

module SitePrism
  module Vcr
    class Element < SimpleDelegator
      def initialize(element, parent, options = {})
        super element

        @parent, @options = parent, options

        @fixtures_handler = FixturesHandler.new options
        @waiter           = Waiter.new parent, options
      end

      def click_and_apply_vcr(*args, &block)
        if block_given?
          adjust_fixtures &block
        else
          @fixtures_handler.apply *args
        end

        self.click

        @waiter.wait
      end

      protected
        def adjust_fixtures(&block)
          adjuster = FixturesAdjuster.new @fixtures_handler, @options
          adjuster.instance_eval &block
          adjuster.modify_fixtures

          @waiter.waiter = adjuster.waiter
        end
    end
  end
end
{'fraction_non_alphanumeric': 0.06332757628094415, 'fraction_numerical': 0.0, 'mean_word_length': 2.033158813263525, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '5911618', 'n_tokens_mistral': 496, 'n_tokens_neox': 476, 'n_words': 120}