<commit_before>module Sidekiq
  module Superworker
    class WorkerClass
      class << self
        attr_reader :nested_hash

        def is_a_superworker?
          true
        end

        def perform_async(*arg_values)
          options = initialize_superjob(arg_values)
          subjobs = create_subjobs(arg_values)
          SuperjobProcessor.create(@superjob_id, @class_name, arg_values, subjobs, options)
        end

        protected

        def initialize_superjob(arg_values)
          options = {}
          
          # If an additional argument value is given, it's the superjob's options
          if (arg_values.length == @arg_keys.length + 1) && arg_values.last.is_a?(Hash)
            options = arg_values.last
          elsif @arg_keys.length != arg_values.length
            raise "Wrong number of arguments for #{name}.perform_async (#{arg_values.length} for #{@arg_keys.length})"
          end

          @args = Hash[@arg_keys.zip(arg_values)]
          @superjob_id = SecureRandom.hex(12)
<commit_msg>Allow superjob meta to be set using perform_async<commit_after>module Sidekiq
  module Superworker
    class WorkerClass
      class << self
        attr_reader :nested_hash

        def is_a_superworker?
          true
        end

        def perform_async(*arg_values)
          options = initialize_superjob(arg_values)
          subjobs = create_subjobs(arg_values, options)
          SuperjobProcessor.create(@superjob_id, @class_name, arg_values, subjobs, options)
        end

        protected

        def initialize_superjob(arg_values)
          options = {}
          
          # If an additional argument value is given, it's the superjob's options
          if (arg_values.length == @arg_keys.length + 1) && arg_values.last.is_a?(Hash)
            options = arg_values.last
          elsif @arg_keys.length != arg_values.length
            raise "Wrong number of arguments for #{name}.perform_async (#{arg_values.length} for #{@arg_keys.length})"
          end

          @args = Hash[@arg_keys.zip(arg_values)]
          @superjob_id = SecureRandom.hex(12)

{'fraction_non_alphanumeric': 0.08226343319067998, 'fraction_numerical': 0.0028530670470756064, 'mean_word_length': 2.3449920508744038, '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': '7044875', 'n_tokens_mistral': 615, 'n_tokens_neox': 590, 'n_words': 140}