<commit_before># frozen_string_literal: true
require "bundler/remote_specification"

module Bundler
  class StubSpecification < RemoteSpecification
    def self.from_stub(stub)
      spec = new(stub.name, stub.version, stub.platform, nil)
      spec.stub = stub
      spec
    end

    attr_accessor :stub, :ignored

    def source=(source)
      super
      # Stub has no concept of source, which means that extension_dir may be wrong
      # This is the case for git-based gems. So, instead manually assign the extension dir
      if source.respond_to?(:extension_dir_name)
        path = File.join(stub.extensions_dir, source.extension_dir_name)
        stub.extension_dir = File.expand_path(path)
      else
        stub.extension_dir = nil
      end
    end

    def to_yaml
      _remote_specification.to_yaml
    end

    # @!group Stub Delegates

    if Bundler.rubygems.provides?(">= 2.3")
      # This is defined directly to avoid having to load every installed spec<commit_msg>Block for RubyGems > 2.2.0<commit_after># frozen_string_literal: true
require "bundler/remote_specification"

module Bundler
  class StubSpecification < RemoteSpecification
    def self.from_stub(stub)
      spec = new(stub.name, stub.version, stub.platform, nil)
      spec.stub = stub
      spec
    end

    attr_accessor :stub, :ignored

    # Pre 2.2.0 did not include extension_dir
    # https://github.com/rubygems/rubygems/commit/9485ca2d101b82a946d6f327f4bdcdea6d4946ea
    if Bundler.rubygems.provides?(">= 2.2.0")
      def source=(source)
        super
        # Stub has no concept of source, which means that extension_dir may be wrong
        # This is the case for git-based gems. So, instead manually assign the extension dir
        if source.respond_to?(:extension_dir_name)
          path = File.join(stub.extensions_dir, source.extension_dir_name)
          stub.extension_dir = File.expand_path(path)
        end
      end
    end

    def to_yaml
      _remote_specification.to_yaml
    end

    # @!group Stub Delegates

    if Bundler.rubygems.provides?(">= 2.3")
      # This is defined directly to avoid having to load every installed spec
{'fraction_non_alphanumeric': 0.07520891364902507, 'fraction_numerical': 0.016713091922005572, 'mean_word_length': 2.9324817518248176, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 7, 'https://': 1, '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': '1190556', 'n_tokens_mistral': 684, 'n_tokens_neox': 674, 'n_words': 186}