Class: Malachite::FileCompiler

Inherits:
Object
  • Object
show all
Defined in:
lib/malachite/file_compiler.rb

Instance Method Summary collapse

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

#compileObject



7
8
9
10
11
12
13
14
15
16
17
18
# File 'lib/malachite/file_compiler.rb', line 7

def compile
  File.open(path_to_tmp_file(@file), 'w') do |file|
    if file_has_handle_function?(@file)
      file.puts cgo_tmpl
      file.puts source_file(@file)
      file.puts exporter_boilerplate(@file)
    else
      file.puts File.read(@file)
    end
    file.close
  end
end