Class: CxxStdlib

Inherits:
Object show all
Defined in:
cxxstdlib.rb

Overview

Combination of C++ standard library and compiler.

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(type, compiler) ⇒ CxxStdlib

Returns a new instance of CxxStdlib.



16
17
18
19
# File 'cxxstdlib.rb', line 16

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

Instance Attribute Details

#compilerObject (readonly)

Returns the value of attribute compiler.



14
15
16
# File 'cxxstdlib.rb', line 14

def compiler
  @compiler
end

#typeObject (readonly)

Returns the value of attribute type.



14
15
16
# File 'cxxstdlib.rb', line 14

def type
  @type
end

Class Method Details

.create(type, compiler) ⇒ Object

Raises:

  • (ArgumentError)


8
9
10
11
12
# File 'cxxstdlib.rb', line 8

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:



26
27
28
# File 'cxxstdlib.rb', line 26

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

#type_stringObject



21
22
23
# File 'cxxstdlib.rb', line 21

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