<commit_before>require 'when_committed/version'

module WhenCommitted
  module ActiveRecord
    def self.included(base)
      base.after_commit :run_when_committed_callbacks
      base.after_rollback :clear_when_committed_callbacks
    end

    def when_committed(&block)
      when_committed_callbacks << block
    end

    def when_committed!(&block)
      if self.connection.open_transactions > 0
        when_committed(&block)
      else
        block.call
      end
    end

    private

    def when_committed_callbacks
      @when_committed_callbacks ||= []
    end

    def run_when_committed_callbacks
      when_committed_callbacks.each {|cb| cb.call}
      clear_when_committed_callbacks
    end

    def clear_when_committed_callbacks
      when_committed_callbacks.clear
    end<commit_msg>Fix method removed in rails 4<commit_after>require 'when_committed/version'

module WhenCommitted
  module ActiveRecord
    def self.included(base)
      base.after_commit :run_when_committed_callbacks
      base.after_rollback :clear_when_committed_callbacks
    end

    def when_committed(&block)
      when_committed_callbacks << block
    end

    def when_committed!(&block)
      if self.class.connection.open_transactions > 0
        when_committed(&block)
      else
        block.call
      end
    end

    private

    def when_committed_callbacks
      @when_committed_callbacks ||= []
    end

    def run_when_committed_callbacks
      when_committed_callbacks.each {|cb| cb.call}
      clear_when_committed_callbacks
    end

    def clear_when_committed_callbacks
      when_committed_callbacks.clear
    end
{'fraction_non_alphanumeric': 0.05221130221130221, 'fraction_numerical': 0.0018427518427518428, 'mean_word_length': 3.1240506329113926, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 5, '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': '2719373', 'n_tokens_mistral': 518, 'n_tokens_neox': 499, 'n_words': 92}