mirror of
https://github.com/Homebrew/brew.git
synced 2025-07-14 16:09:03 +08:00
32 lines
614 B
Ruby
32 lines
614 B
Ruby
# typed: true
|
|
# frozen_string_literal: true
|
|
|
|
require "compilers"
|
|
|
|
# Combination of C++ standard library and compiler.
|
|
class CxxStdlib
|
|
extend T::Sig
|
|
|
|
def self.create(type, compiler)
|
|
raise ArgumentError, "Invalid C++ stdlib type: #{type}" if type && [:libstdcxx, :libcxx].exclude?(type)
|
|
|
|
CxxStdlib.new(type, compiler)
|
|
end
|
|
|
|
attr_reader :type, :compiler
|
|
|
|
def initialize(type, compiler)
|
|
@type = type
|
|
@compiler = compiler.to_sym
|
|
end
|
|
|
|
def type_string
|
|
type.to_s.gsub(/cxx$/, "c++")
|
|
end
|
|
|
|
sig { returns(String) }
|
|
def inspect
|
|
"#<#{self.class.name}: #{compiler} #{type}>"
|
|
end
|
|
end
|