<commit_before>require "dry/transaction/step"
require "dry/transaction/step_adapters"
require "dry/transaction/sequence"

module Dry
  module Transaction
    # @api private
    class DSL
      attr_reader :container
      attr_reader :step_adapters
      attr_reader :steps

      def initialize(options, &block)
        @container = options.fetch(:container)
        @step_adapters = options.fetch(:step_adapters, StepAdapters)
        @steps = []

        instance_eval(&block)
      end

      def respond_to_missing?(method_name)
        step_adapters.key?(method_name)
      end

      def method_missing(method_name, *args)
        return super unless step_adapters.key?(method_name)

        step_adapter = step_adapters[method_name]
        step_name = args.first
        options = args.last.is_a?(Hash) ? args.last : {}
        operation_name = options.delete(:with) || step_name
        operation = container[operation_name]

        steps << Step.new(step_adapter, step_name, operation_name, operation, options)
      end

      def call
        Sequence.new(steps)
      end
    end<commit_msg>Dry::Transaction::DSL should inherit from BasicObject<commit_after>require "dry/transaction/step"
require "dry/transaction/step_adapters"
require "dry/transaction/sequence"

module Dry
  module Transaction
    # @api private
    class DSL < BasicObject
      attr_reader :container
      attr_reader :step_adapters
      attr_reader :steps

      def initialize(options, &block)
        @container = options.fetch(:container)
        @step_adapters = options.fetch(:step_adapters, StepAdapters)
        @steps = []

        instance_eval(&block)
      end

      def respond_to_missing?(method_name)
        step_adapters.key?(method_name)
      end

      def method_missing(method_name, *args)
        return super unless step_adapters.key?(method_name)

        step_adapter = step_adapters[method_name]
        step_name = args.first
        options = args.last.is_a?(::Hash) ? args.last : {}
        operation_name = options.delete(:with) || step_name
        operation = container[operation_name]

        steps << Step.new(step_adapter, step_name, operation_name, operation, options)
      end

      def call
        Sequence.new(steps)
      end
    end
{'fraction_non_alphanumeric': 0.08862433862433862, 'fraction_numerical': 0.0, 'mean_word_length': 2.8786324786324786, 'pattern_counts': {'":': 0, '<': 8, '<?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': '2853598', 'n_tokens_mistral': 680, 'n_tokens_neox': 647, 'n_words': 136}