Class: Malachite::FileCompiler
- Inherits:
-
Object
- Object
- Malachite::FileCompiler
- Defined in:
- lib/malachite/file_compiler.rb
Instance Method Summary collapse
- #compile ⇒ Object
-
#initialize(file) ⇒ FileCompiler
constructor
A new instance of FileCompiler.
Constructor Details
#initialize(file) ⇒ FileCompiler
Returns a new instance of FileCompiler.
3 4 5 |
# File 'lib/malachite/file_compiler.rb', line 3 def initialize(file) @file = file end |
Instance Method Details
#compile ⇒ Object
7 8 9 10 11 12 13 14 15 16 17 |
# File 'lib/malachite/file_compiler.rb', line 7 def compile File.open(path_to_tmp_file(@file), 'w') do |file| file.puts 'package main' file.puts '// #include <stdlib.h>' file.puts "import \"C\"" file.puts "import \"unsafe\"" file.puts source_file(@file) file.puts exporter_boilerplate(@file) file.close end end |