<commit_before>require 'dry-container'

module Opie
  class Operation
    attr_reader :container

    def initialize(params = {}, dependencies = {})
      @container = Dry::Container.new
      @container.register('params', params)
      dependencies.each { |k, v| @container.register(k, v) }
    end

    class << self
      def call(*args)
        instance = self.new(*args)
        instance.send(:execute_steps, step_list)
        instance
      end

      def step(step)
        add_step(step)
      end

      private

      def add_step(value)
        @steps ||= []
        @steps << value
      end

      def step_list
        @steps ||= []
      end
    end

    def fail
      'fail'
    end

    # def []=(key, value)
    #   container.register(key, value)
    # end
    # result, container

    def success?
      !@failure
    end

    def failure?
      @failure
    end

    private

    def execute_steps(steps)
      @failure = steps.find { |m| send(m) == 'fail' }
    end
  end
end<commit_msg>test: use failure? method for returning success?<commit_after>require 'dry-container'

module Opie
  class Operation
    attr_reader :container

    def initialize(params = {}, dependencies = {})
      @container = Dry::Container.new
      @container.register('params', params)
      dependencies.each { |k, v| @container.register(k, v) }
    end

    class << self
      def call(*args)
        instance = self.new(*args)
        instance.send(:execute_steps, step_list)
        instance
      end

      def step(step)
        add_step(step)
      end

      private

      def add_step(value)
        @steps ||= []
        @steps << value
      end

      def step_list
        @steps ||= []
      end
    end

    def fail
      'fail'
    end

    # def []=(key, value)
    #   container.register(key, value)
    # end
    # result, container

    def success?
      !failure?
    end

    def failure?
      @failure
    end

    private

    def execute_steps(steps)
      @failure = steps.find { |m| send(m) == 'fail' }
    end
  end
end
{'fraction_non_alphanumeric': 0.11046228710462287, 'fraction_numerical': 0.0, 'mean_word_length': 1.8998589562764456, 'pattern_counts': {'":': 0, '<': 11, '<?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': '7518708', 'n_tokens_mistral': 642, 'n_tokens_neox': 617, 'n_words': 161}