Class: CCompiler

Inherits:
Object
  • Object
show all
Defined in:
lib/lake/plugins/cpp.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(compiler: "gcc", flags: "") ⇒ CCompiler

Returns a new instance of CCompiler.



3
4
5
# File 'lib/lake/plugins/cpp.rb', line 3

def initialize(compiler:"gcc",flags:"")
  @flags,@compiler = flags,compiler
end

Instance Attribute Details

#compilerObject

Returns the value of attribute compiler.



2
3
4
# File 'lib/lake/plugins/cpp.rb', line 2

def compiler
  @compiler
end

#flagsObject

Returns the value of attribute flags.



2
3
4
# File 'lib/lake/plugins/cpp.rb', line 2

def flags
  @flags
end

Instance Method Details

#compile(source, output = nil) ⇒ Object



12
13
14
15
# File 'lib/lake/plugins/cpp.rb', line 12

def compile(source,output=nil)
  output ||= File.basename(source,".*") + ".out"
  system "#{@compiler} #{@flags} -o \"#{output}\" \"#{source}\""
end

#system(code) ⇒ Object



7
8
9
10
# File 'lib/lake/plugins/cpp.rb', line 7

def system(code)
  puts code
  super code
end