diff options
-rw-r--r-- | lib/efl/eina.rb | 38 | ||||
-rw-r--r-- | spec/eina_spec.rb | 22 |
2 files changed, 60 insertions, 0 deletions
diff --git a/lib/efl/eina.rb b/lib/efl/eina.rb new file mode 100644 index 0000000..8f6b097 --- /dev/null +++ b/lib/efl/eina.rb @@ -0,0 +1,38 @@ +#! /usr/bin/env ruby +# -*- coding: UTF-8 -*- +# +require 'ffi' +# +module EFL + module EINA + # + MAJOR = 0 + MINOR = 0 + REVISION = 1 + VERSION = [MAJOR,MINOR,REVISION].join '.' + # + extend FFI::Library + # + ffi_lib 'eina' + functions = [ + [ :eina_init, [ ], :int ], + [ :eina_shutdown, [], :int ], + ].each do |func| + begin + attach_function *func + rescue Object => e + puts "Could not attach #{func} #{e.message}" + end + end + # + def self.init + eina_init + end + # + def self.shutdown + eina_shutdown + end + # + end +end +# diff --git a/spec/eina_spec.rb b/spec/eina_spec.rb new file mode 100644 index 0000000..694e2b2 --- /dev/null +++ b/spec/eina_spec.rb @@ -0,0 +1,22 @@ +#! /usr/bin/env ruby +# -*- coding: UTF-8 -*- +# +require 'efl/eina' +# +describe EFL::EINA do + # + include EFL + # + it "should init" do + EINA.init.should eql 1 + EINA.init.should eql 2 + EINA.init.should eql 3 + end + # + it "should shutdown" do + EINA.shutdown.should eql 2 + EINA.shutdown.should eql 1 + EINA.shutdown.should eql 0 + end + # +end |