<commit_before>module Bootstrap
  class FrameworkNotFound < StandardError; end

  # Inspired by Kaminari
  def self.load!
    if compass?
      require 'bootstrap-sass/compass_functions'
      register_compass_extension
    elsif asset_pipeline?
      require 'bootstrap-sass/sass_functions'
    end

    if rails?
      require 'sass-rails'
      register_rails_engine
    end

    unless rails? || compass?
      raise Bootstrap::FrameworkNotFound,
            'bootstrap-sass requires either Rails > 3.1 or Compass, neither of which are loaded'
    end

    bs_stylesheets = File.join(gem_path, 'vendor', 'assets', 'stylesheets')
    ::Sass.load_paths << bs_stylesheets
    if ::Sass::Script::Number.precision < 10
      # see https://github.com/thomas-mcdonald/bootstrap-sass/issues/409
      ::Sass::Script::Number.precision = 10
    end
  end

  private

  def self.gem_path
    @gem_path ||= File.expand_path File.join('..'), File.dirname(__FILE__)
  end

  def self.asset_pipeline?
    defined?(::Sprockets)
  end

  def self.compass?
    defined?(::Compass)
  end

  def self.rails?
    defined?(::Rails)
  end

  def self.register_compass_extension
    styles    = File.join gem_path, 'vendor', 'assets', 'stylesheets'
    templates = File.join gem_path, 'templates'
    ::Compass::Frameworks.register(
        'bootstrap',
        :path                  => gem_path,
        :stylesheets_directory => styles,
        :templates_directory   => templates
    )
  end

  def self.register_rails_engine
    require 'bootstrap-sass/engine'
  end
end

Bootstrap.load!<commit_msg>fix private on class methods + tiny refactorings<commit_after>module Bootstrap
  class FrameworkNotFound < StandardError; end

  class << self
    # Inspired by Kaminari
    def load!
      if compass?
        require 'bootstrap-sass/compass_functions'
        register_compass_extension
      elsif asset_pipeline?
        require 'bootstrap-sass/sass_functions'
      end

      if rails?
        require 'sass-rails'
        register_rails_engine
      end

      unless rails? || compass?
        raise Bootstrap::FrameworkNotFound,
              'bootstrap-sass requires either Rails > 3.1 or Compass, neither of which are loaded'
      end

      configure_sass
    end

    private

    def configure_sass
      ::Sass.load_paths << File.join(gem_path, 'vendor', 'assets', 'stylesheets')

      # bootstrap requires minimum precision of 10, see https://github.com/thomas-mcdonald/bootstrap-sass/issues/409
      ::Sass::Script::Number.precision = [10, ::Sass::Script::Number.precision].max
    end

    def gem_path
      @gem_path ||= File.expand_path File.join('..'), File.dirname(__FILE__)
    end

    def register_compass_extension
      styles    = File.join gem_path, 'vendor', 'assets', 'stylesheets'
      templates = File.join gem_path, 'templates'
      ::Compass::Frameworks.register(
          'bootstrap',
          :path                  => gem_path,
          :stylesheets_directory => styles,
          :templates_directory   => templates
      )
    end

    def register_rails_engine
      require 'bootstrap-sass/engine'
    end

    def asset_pipeline?
      defined?(::Sprockets)
    end

    def compass?
      defined?(::Compass)
    end

    def rails?
      defined?(::Rails)
    end
  end
end

Bootstrap.load!
{'fraction_non_alphanumeric': 0.09768560264502554, 'fraction_numerical': 0.005410279531109108, 'mean_word_length': 2.6611661166116614, 'pattern_counts': {'":': 0, '<': 12, '<?xml version=': 0, '>': 11, 'https://': 2, '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': '2319327', 'n_tokens_mistral': 1042, 'n_tokens_neox': 975, 'n_words': 231}