<commit_before>module Afterburner
  module Framework
    class BaseInteractor
      class << self
        def call(data, options = {})
          new(data, options).to_response
        end
      end

      def to_response
        raise "#to_response must be specified!"
      end

      protected
      def initialize(data, options = {})
      end
    end
  end
end
<commit_msg>Made the BaseInteractor behave like the BaseConductor<commit_after>module Afterburner
  module Framework
    class BaseInteractor
      # Runs the interactor and returns a hash of objects (presenter or
      # otherwise) that are passed to the view.
      #
      # @param data [Hash] Data supplied to the interactor.
      # @param options [Hash] A series of options that override default values.
      # @return [Hash] An associative array of presenter objects to be passed to the view.
      def self.call(data, options = {})
        new(data, options).to_response
      end

      def to_response
        raise "#to_response must be specified!"
      end

      protected
      attr_accessor :data, :options
      def initialize(data, options = {})
        self.data = data
        self.options = defaults.merge(options)
      end

      # Provides a frozen hash of sane defaults that can be overridden to change class
      # behaviour. Highly useful for dependency injection to simplify testing. For
      # instance, instead of hard-coding a repository object, specify a default for it
      # so that you can pass in a mock when testing.
      #
      # @return [Hash] An associative array of defaults.
      def defaults
        Hash.new.freeze
      end
    end
  end
end

{'fraction_non_alphanumeric': 0.05907172995780591, 'fraction_numerical': 0.0, 'mean_word_length': 2.3333333333333335, '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': '1359653', 'n_tokens_mistral': 437, 'n_tokens_neox': 425, 'n_words': 180}