Class: Inliner::Compilers::Compiler

Inherits:
Object
  • Object
show all
Defined in:
lib/ffi-inliner/inliner.rb

Direct Known Subclasses

GCC, TCC

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(fm = nil, libraries = nil) ⇒ Compiler

Returns a new instance of Compiler.



70
71
72
73
74
# File 'lib/ffi-inliner/inliner.rb', line 70

def initialize(fm = nil, libraries = nil)
  @fm = fm
  @libraries = libraries
  @progname = cmd.split.first
end

Instance Attribute Details

#prognameObject (readonly)

Returns the value of attribute progname.



61
62
63
# File 'lib/ffi-inliner/inliner.rb', line 61

def progname
  @progname
end

Class Method Details

.check_and_create(fm = nil, libraries = nil) ⇒ Object



62
63
64
65
66
67
68
69
# File 'lib/ffi-inliner/inliner.rb', line 62

def self.check_and_create(fm = nil, libraries = nil)
  compiler = new(fm, libraries) 
  unless compiler.exists?
    raise "Can't find compiler #{compiler.class}"
  else
    compiler
  end
end

Instance Method Details

#compileObject



75
76
77
# File 'lib/ffi-inliner/inliner.rb', line 75

def compile
  raise "Compile error! See #{@fm.log_fn}" unless system(cmd)
end