<commit_before># frozen_string_literal: true

module GirFFIGst
  # Override init to automatically use ARGV as its argument.
  module AutoArgv
    def self.included(base)
      base.extend ClassMethods
      class << base
        alias_method :init_without_auto_argv, :init
        alias_method :init, :init_with_auto_argv
      end
    end

    # Implementation of class methods for AutoArgv
    module ClassMethods
      def init_with_auto_argv
        remaining = init_without_auto_argv([$PROGRAM_NAME, *ARGV]).to_a
        remaining.shift
        ARGV.replace remaining
      end
    end
  end
end

# Overrides for Gst module functions
module Gst
  setup_method 'init'

  include GirFFIGst::AutoArgv
end<commit_msg>Use exception-raising method setup functions<commit_after># frozen_string_literal: true

module GirFFIGst
  # Override init to automatically use ARGV as its argument.
  module AutoArgv
    def self.included(base)
      base.extend ClassMethods
      class << base
        alias_method :init_without_auto_argv, :init
        alias_method :init, :init_with_auto_argv
      end
    end

    # Implementation of class methods for AutoArgv
    module ClassMethods
      def init_with_auto_argv
        remaining = init_without_auto_argv([$PROGRAM_NAME, *ARGV]).to_a
        remaining.shift
        ARGV.replace remaining
      end
    end
  end
end

# Overrides for Gst module functions
module Gst
  setup_method! 'init'

  include GirFFIGst::AutoArgv
end
{'fraction_non_alphanumeric': 0.05040871934604905, 'fraction_numerical': 0.0, 'mean_word_length': 3.1033519553072626, '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': '7425331', 'n_tokens_mistral': 446, 'n_tokens_neox': 437, 'n_words': 127}