<commit_before>class Premailer
  module Rails
    module CSSLoaders
      module AssetPipelineLoader
        extend self

        def load(url)
          return unless asset_pipeline_present?

          file = file_name(url)
          ::Rails.application.assets_manifest.find_sources(file).first
        rescue Errno::ENOENT, TypeError => _error
        end

        def file_name(url)
          prefix = [
            ::Rails.configuration.relative_url_root,
            ::Rails.configuration.assets.prefix,
            '/'
          ].join
          URI(url).path
            .sub(/\A#{prefix}/, '')
            .sub(/-(\h{32}|\h{64})\.css\z/, '.css')
        end

        def asset_pipeline_present?
          defined?(::Rails) &&
            ::Rails.application &&
            ::Rails.application.respond_to?(:assets_manifest) &&
            ::Rails.application.assets_manifest
        end
      end
    end
  end
end<commit_msg>Check that Rails.configuration is defined before calling<commit_after>class Premailer
  module Rails
    module CSSLoaders
      module AssetPipelineLoader
        extend self

        def load(url)
          return unless asset_pipeline_present?

          file = file_name(url)
          ::Rails.application.assets_manifest.find_sources(file).first
        rescue Errno::ENOENT, TypeError => _error
        end

        def file_name(url)
          prefix = [
            ::Rails.configuration.relative_url_root,
            ::Rails.configuration.assets.prefix,
            '/'
          ].join
          URI(url).path
            .sub(/\A#{prefix}/, '')
            .sub(/-(\h{32}|\h{64})\.css\z/, '.css')
        end

        def asset_pipeline_present?
          defined?(::Rails) &&
            ::Rails.respond_to?(:application) &&
            ::Rails.application &&
            ::Rails.application.respond_to?(:assets_manifest) &&
            ::Rails.application.assets_manifest
        end
      end
    end
  end
end
{'fraction_non_alphanumeric': 0.11338100102145046, 'fraction_numerical': 0.0040858018386108275, 'mean_word_length': 1.770862800565771, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 5, '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': '6740246', 'n_tokens_mistral': 562, 'n_tokens_neox': 546, 'n_words': 96}