Sha256: a3146e836b0e859707599a6e3e649782efa530c8f6d571e141fe77ac49e73e12

Contents?: true

Size: 516 Bytes

Versions: 2

Compression:

Stored size: 516 Bytes

Contents

require 'ffi'

module Confium
  class CFM
    attr_reader :ptr

    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

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

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

  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
confium-0.2.0 lib/confium/cfm.rb
confium-0.1.0 lib/confium/cfm.rb