Class: Rutie
- Inherits:
-
Object
- Object
- Rutie
- Defined in:
- lib/rutie.rb
Instance Method Summary collapse
- #ffi_library(dir) ⇒ Object
- #init(c_init_method_name, dir) ⇒ Object
-
#initialize(project_name, **opts) ⇒ Rutie
constructor
A new instance of Rutie.
Constructor Details
#initialize(project_name, **opts) ⇒ Rutie
Returns a new instance of Rutie.
2 3 4 5 6 7 8 9 10 |
# File 'lib/rutie.rb', line 2 def initialize(project_name, **opts) @os = opts.fetch(:os) { nil } # for testing purposes @project_name = ProjectName.new(project_name) @lib_prefix = opts.fetch(:lib_prefix) { set_prefix } @lib_suffix = opts.fetch(:lib_suffix) { set_suffix } @release = opts.fetch(:release) { 'release' } @full_lib_path = opts.fetch(:lib_path) { nil } end |
Instance Method Details
#ffi_library(dir) ⇒ Object
12 13 14 15 16 |
# File 'lib/rutie.rb', line 12 def ffi_library(dir) file = [ @lib_prefix, @project_name, '.', @lib_suffix ] File.join(lib_path(dir), file.join()) end |
#init(c_init_method_name, dir) ⇒ Object
18 19 20 21 22 |
# File 'lib/rutie.rb', line 18 def init(c_init_method_name, dir) require 'fiddle' Fiddle::Function.new(Fiddle.dlopen(ffi_library dir)[c_init_method_name], [], Fiddle::TYPE_VOIDP).call end |