<commit_before>module Rack
  module Tracker
    module Plugins
      class DSL
        include Rack::Tracker::Macros

        @@currently_defining = nil

        class << self
          @@listeners = []

          def add_hook hook, &block
            Rack::Tracker.listeners << {hook: hook, plugin_method: block}
          end

          def currently_defining
            if @@currently_defining.nil?
              raise Rack::Tracker::Exceptions::UnableToTrackPluginBeingDefined
            else
              @@currently_defining
            end
          end

          def currently_defining= value
            @@currently_defining = value
          end
        end

        def initialize plugin_name, &block
          @@currently_defining = plugin_name
          yield Rack::Tracker::DSL
          eval define_plugin_module plugin_name, &block
        end

        protected

        def define_plugin_module plugin_name, &block
          """
          module Rack::Tracker::Plugins::#{plugin_name.to_s.camelize}
          end
          """
        end
      end
    end
  end
end<commit_msg>Moving things around to improve readability<commit_after>module Rack
  module Tracker
    module Plugins
      class DSL
        include Rack::Tracker::Macros

        @@currently_defining = nil

        def initialize plugin_name, &block
          @@currently_defining = plugin_name
          yield Rack::Tracker::DSL
          eval define_plugin_module plugin_name, &block
        end

        class << self
          @@listeners = []

          def add_hook hook, &block
            Rack::Tracker.listeners << {hook: hook, plugin_method: block}
          end

          def currently_defining
            if @@currently_defining.nil?
              raise Rack::Tracker::Exceptions::UnableToTrackPluginBeingDefined
            else
              @@currently_defining
            end
          end

          def currently_defining= value
            @@currently_defining = value
          end
        end

        protected

        def define_plugin_module plugin_name, &block
          """
          module Rack::Tracker::Plugins::#{plugin_name.to_s.camelize}
          end
          """
        end
      end
    end
  end
end
{'fraction_non_alphanumeric': 0.06726457399103139, 'fraction_numerical': 0.0, 'mean_word_length': 1.6879518072289157, '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': '2245886', 'n_tokens_mistral': 606, 'n_tokens_neox': 564, 'n_words': 140}