Class: CCompiler
- Inherits:
-
Object
- Object
- CCompiler
- Defined in:
- lib/lake/plugins/cpp.rb
Instance Attribute Summary collapse
-
#compiler ⇒ Object
Returns the value of attribute compiler.
-
#flags ⇒ Object
Returns the value of attribute flags.
Instance Method Summary collapse
- #compile(source, output = nil) ⇒ Object
-
#initialize(compiler: "gcc", flags: "") ⇒ CCompiler
constructor
A new instance of CCompiler.
- #system(code) ⇒ Object
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
#compiler ⇒ Object
Returns the value of attribute compiler.
2 3 4 |
# File 'lib/lake/plugins/cpp.rb', line 2 def compiler @compiler end |
#flags ⇒ Object
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 |