<commit_before>require "apn/application"

module APN
  module MultipleApps
    def self.extended(mod)
      class << mod
        alias_method_chain :notify_sync, :app

        delegate(*Application::DELEGATE_METHODS, to: :current_app, prefix: true, allow_nil: true)

        Application::DELEGATE_METHODS.each do |method_name|
          alias_method :"original_#{method_name}", method_name
          alias_method method_name, :"current_app_#{method_name}"
        end
      end
    end

    def notify_sync_with_app(token, notification)
      if notification.is_a?(Hash)
        notification.symbolize_keys!
        app_name = notification.delete(:app)
      end

      with_app(app_name) do
        notify_sync_without_app(token, notification)<commit_msg>use prepend instead of alias_method_chain (rails 5)<commit_after>require "apn/application"

module APNSupportingMultipleApps
  def notify_sync(token, notification)
    if notification.is_a?(Hash)
      notification.symbolize_keys!
      app_name = notification.delete(:app)
    end

    with_app(app_name) do
      super(token, notification)
    end
  end
end

module APN
  module MultipleApps
    def self.extended(mod)
      class << mod
        prepend APNSupportingMultipleApps

        delegate(*Application::DELEGATE_METHODS, to: :current_app, prefix: true, allow_nil: true)

        Application::DELEGATE_METHODS.each do |method_name|
          alias_method :"original_#{method_name}", method_name
          alias_method method_name, :"current_app_#{method_name}"
        end
{'fraction_non_alphanumeric': 0.08257477243172952, 'fraction_numerical': 0.0006501950585175553, 'mean_word_length': 3.4608695652173913, 'pattern_counts': {'":': 0, '<': 7, '<?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': '7426963', 'n_tokens_mistral': 476, 'n_tokens_neox': 464, 'n_words': 97}