diff options
Diffstat (limited to 'lib')
-rw-r--r-- | lib/efl/ffi.rb | 13 |
1 files changed, 10 insertions, 3 deletions
diff --git a/lib/efl/ffi.rb b/lib/efl/ffi.rb index eaa45e7..4419b38 100644 --- a/lib/efl/ffi.rb +++ b/lib/efl/ffi.rb @@ -51,15 +51,22 @@ module Efl m.class_eval "def self.inherited sub; sub.class_eval 'def self.func_prefixes; superclass.func_prefixes; end'; end" end def method_missing m, *args, &block + if m =~/^(.*)=$/ + m_s = $1+'_set' + args_s = '*args[0]' + else + m_s = m.to_s + args_s = '*args' + end self.class.func_prefixes.each do |p| - sym = p+m.to_s + sym = p+m_s if Efl::API.respond_to? sym - self.class.class_eval "def #{m} *args, █ r=Efl::API.#{sym}(@ptr,*args); yield r if block_given?; r; end" + self.class.class_eval "def #{m} *args, █ r=Efl::API.#{sym}(@ptr,#{args_s}); yield r if block_given?; r; end" return self.send m, *args, &block end end r = Efl::API.send m, @ptr, *args - self.class.class_eval "def #{m} *args, █ r=Efl::API.#{m}(@ptr,*args); yield r if block_given?; r; end" + self.class.class_eval "def #{m} *args, █ r=Efl::API.#{m}(@ptr,#{args_s}); yield r if block_given?; r; end" r end end |