Sha256: 4c4703182d02e4730be6d61db896308b64cde2af58a8f5e6c57d9a74792cf4e6

Contents?: true

Size: 1.08 KB

Versions: 27

Compression:

Stored size: 1.08 KB

Contents

# frozen_string_literal: true
module Bundler
  module GemHelpers
    GENERIC_CACHE = {} # rubocop:disable MutableConstant
    GENERICS = [
      [Gem::Platform.new("java"), Gem::Platform.new("java")],
      [Gem::Platform.new("mswin32"), Gem::Platform.new("mswin32")],
      [Gem::Platform.new("mswin64"), Gem::Platform.new("mswin64")],
      [Gem::Platform.new("universal-mingw32"), Gem::Platform.new("universal-mingw32")],
      [Gem::Platform.new("x64-mingw32"), Gem::Platform.new("x64-mingw32")],
      [Gem::Platform.new("x86_64-mingw32"), Gem::Platform.new("x64-mingw32")],
      [Gem::Platform.new("mingw32"), Gem::Platform.new("x86-mingw32")]
    ].freeze

    def generic(p)
      return p if p == Gem::Platform::RUBY

      GENERIC_CACHE[p] ||= begin
        _, found = GENERICS.find do |match, _generic|
          p.os == match.os && (!match.cpu || p.cpu == match.cpu)
        end
        found || Gem::Platform::RUBY
      end
    end
    module_function :generic

    def generic_local_platform
      generic(Gem::Platform.local)
    end
    module_function :generic_local_platform
  end
end

Version data entries

27 entries across 27 versions & 2 rubygems

Version Path
bundler-1.13.7 lib/bundler/gem_helpers.rb
bundler-1.13.6 lib/bundler/gem_helpers.rb
bundler-1.13.5 lib/bundler/gem_helpers.rb
bundler-1.13.4 lib/bundler/gem_helpers.rb
bundler-1.13.3 lib/bundler/gem_helpers.rb
bundler-1.12.6 lib/bundler/gem_helpers.rb
bundler-1.13.2 lib/bundler/gem_helpers.rb
rubygems-update-2.6.7 bundler/lib/bundler/gem_helpers.rb
bundler-1.13.1 lib/bundler/gem_helpers.rb
bundler-1.13.0 lib/bundler/gem_helpers.rb
bundler-1.13.0.rc.2 lib/bundler/gem_helpers.rb
bundler-1.13.0.rc.1 lib/bundler/gem_helpers.rb
rubygems-update-2.6.6 bundler/lib/bundler/gem_helpers.rb
rubygems-update-2.6.5 bundler/lib/bundler/gem_helpers.rb
bundler-1.13.0.pre.1 lib/bundler/gem_helpers.rb
bundler-1.12.5 lib/bundler/gem_helpers.rb
bundler-1.12.4 lib/bundler/gem_helpers.rb
bundler-1.12.3 lib/bundler/gem_helpers.rb
bundler-1.12.2 lib/bundler/gem_helpers.rb
bundler-1.12.1 lib/bundler/gem_helpers.rb