Class: Confium::CFM

Inherits:
Object
  • Object
show all
Defined in:
lib/confium/cfm.rb

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initializeCFM

Returns a new instance of CFM.



7
8
9
10
11
12
13
# File 'lib/confium/cfm.rb', line 7

def initialize
  pptr = FFI::MemoryPointer.new(:pointer)
  Confium.call_ffi(:cfm_create, pptr)
  @ptr = FFI::AutoPointer.new(pptr.read_pointer, self.class.method(:destroy))

  load_plugin('botan', ENV['CFM_HASH_BOTAN_PLUGIN_PATH'])
end

Instance Attribute Details

#ptrObject (readonly)

Returns the value of attribute ptr.



5
6
7
# File 'lib/confium/cfm.rb', line 5

def ptr
  @ptr
end

Class Method Details

.destroy(ptr) ⇒ Object



15
16
17
# File 'lib/confium/cfm.rb', line 15

def self.destroy(ptr)
  Confium::Lib.cfm_destroy(ptr)
end

Instance Method Details

#load_plugin(name, path) ⇒ Object



19
20
21
# File 'lib/confium/cfm.rb', line 19

def load_plugin(name, path)
  Confium.call_ffi(:cfm_plugin_load, @ptr, name, path, nil, nil)
end