<commit_before>module Chanko
  module Unit
    class ScopeFinder
      LABEL_SCOPE_MAP = {
        :controller => ActionController::Base,
        :model      => ActiveRecord::Base,
        :view       => ActionView::Base,
      }

      def self.find(*args)
        new(*args).find
      end

      def initialize(identifier)
        @identifier = identifier
      end

      def find
        case
        when class?
          @identifier
        when label
          label
        else
          @identifier.to_s.constantize
        end
      rescue NameError
      end

      private

      def class?
        @identifier.is_a?(Class)
      end

      def label
        LABEL_SCOPE_MAP[@identifier]
      end
    end
  end
end<commit_msg>Stop referencing {AC,AR,AV}::Base in a top-level constant<commit_after>module Chanko
  module Unit
    class ScopeFinder
      def self.find(*args)
        new(*args).find
      end

      def initialize(identifier)
        @identifier = identifier
      end

      def find
        case
        when class?
          @identifier
        when label
          label
        else
          @identifier.to_s.constantize
        end
      rescue NameError
      end

      private

      def class?
        @identifier.is_a?(Class)
      end

      def label
        label_scope_map = {
          :controller => ActionController::Base,
          :model      => ActiveRecord::Base,
          :view       => ActionView::Base
        }

        label_scope_map[@identifier]
      end
    end
  end
end
{'fraction_non_alphanumeric': 0.06905537459283388, 'fraction_numerical': 0.0, 'mean_word_length': 1.4935064935064934, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 9, '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': '7534286', 'n_tokens_mistral': 429, 'n_tokens_neox': 417, 'n_words': 103}