Class: CxxStdlib

Inherits:
Object
  • Object
show all
Extended by:
T::Sig
Defined in:
cxxstdlib.rb

Overview

Combination of C++ standard library and compiler.

Defined Under Namespace

Classes: CompatibilityError

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(type, compiler) ⇒ CxxStdlib

Returns a new instance of CxxStdlib.



30
31
32
33
# File 'cxxstdlib.rb', line 30

def initialize(type, compiler)
  @type = type
  @compiler = compiler.to_sym
end

Instance Attribute Details

#compilerObject (readonly)

Returns the value of attribute compiler.



28
29
30
# File 'cxxstdlib.rb', line 28

def compiler
  @compiler
end

#typeObject (readonly)

Returns the value of attribute type.



28
29
30
# File 'cxxstdlib.rb', line 28

def type
  @type
end

Class Method Details

.create(type, compiler) ⇒ Object

Raises:

  • (ArgumentError)


22
23
24
25
26
# File 'cxxstdlib.rb', line 22

def self.create(type, compiler)
  raise ArgumentError, "Invalid C++ stdlib type: #{type}" if type && [:libstdcxx, :libcxx].exclude?(type)

  CxxStdlib.new(type, compiler)
end

Instance Method Details

#inspectString

Returns:



40
41
42
# File 'cxxstdlib.rb', line 40

def inspect
  "#<#{self.class.name}: #{compiler} #{type}>"
end

#type_stringObject



35
36
37
# File 'cxxstdlib.rb', line 35

def type_string
  type.to_s.gsub(/cxx$/, "c++")
end