From 1070788ba72c54e3a48d27339367a8e597402b3a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=A9r=C3=A9my=20Zurcher?= Date: Sat, 9 Apr 2011 00:06:09 +0200 Subject: add edje --- lib/efl/edje.rb | 38 ++++++++++++++++++++++++++++++++++++++ spec/edje_spec.rb | 22 ++++++++++++++++++++++ 2 files changed, 60 insertions(+) create mode 100644 lib/efl/edje.rb create mode 100644 spec/edje_spec.rb diff --git a/lib/efl/edje.rb b/lib/efl/edje.rb new file mode 100644 index 0000000..ba00725 --- /dev/null +++ b/lib/efl/edje.rb @@ -0,0 +1,38 @@ +#! /usr/bin/env ruby +# -*- coding: UTF-8 -*- +# +require 'ffi' +# +module EFL + module EDJE + # + MAJOR = 0 + MINOR = 0 + REVISION = 1 + VERSION = [MAJOR,MINOR,REVISION].join '.' + # + extend FFI::Library + # + ffi_lib 'edje' + functions = [ + [ :edje_init, [ ], :int ], + [ :edje_shutdown, [], :int ], + ].each do |func| + begin + attach_function *func + rescue Object => e + puts "Could not attach #{func} #{e.message}" + end + end + # + def self.init + edje_init + end + # + def self.shutdown + edje_shutdown + end + # + end +end +# diff --git a/spec/edje_spec.rb b/spec/edje_spec.rb new file mode 100644 index 0000000..89fbc62 --- /dev/null +++ b/spec/edje_spec.rb @@ -0,0 +1,22 @@ +#! /usr/bin/env ruby +# -*- coding: UTF-8 -*- +# +require 'efl/edje' +# +describe EFL::EDJE do + # + include EFL + # + it "should init" do + EDJE.init.should eql 1 + EDJE.init.should eql 2 + EDJE.init.should eql 3 + end + # + it "should shutdown" do + EDJE.shutdown.should eql 2 + EDJE.shutdown.should eql 1 + EDJE.shutdown.should eql 0 + end + # +end -- cgit v1.1-2-g2b99