summaryrefslogtreecommitdiffstats
path: root/lib
diff options
context:
space:
mode:
authorJérémy Zurcher <jeremy@asynk.ch>2011-04-14 07:30:04 +0200
committerJérémy Zurcher <jeremy@asynk.ch>2011-04-14 07:30:04 +0200
commitc73ec67bdca66b39b1bcea63434c560f21af2d4a (patch)
tree68ff6b9bb94d5c355a972937e04d81c1824ee283 /lib
parentb960e00f5d165c659c7dc827b65ff8b563e84f10 (diff)
downloadffi-efl-c73ec67bdca66b39b1bcea63434c560f21af2d4a.zip
ffi-efl-c73ec67bdca66b39b1bcea63434c560f21af2d4a.tar.gz
update ffi_helper API
Diffstat (limited to 'lib')
-rw-r--r--lib/e17/ffi_helper.rb16
1 files changed, 7 insertions, 9 deletions
diff --git a/lib/e17/ffi_helper.rb b/lib/e17/ffi_helper.rb
index 36c9c6b..5aaf7a4 100644
--- a/lib/e17/ffi_helper.rb
+++ b/lib/e17/ffi_helper.rb
@@ -4,8 +4,8 @@
require 'ffi'
#
module FFIHelper
- def attach_fcts
- @fcts.each do |func|
+ def attach_fcts fcts
+ fcts.each do |func|
begin
attach_function *func
rescue Object => e
@@ -13,14 +13,12 @@ module FFIHelper
end
end
end
- def create_aliases l
- @fcts.each do |f,a,r|
- module_eval <<-code
- class << self
- alias #{f.to_s[l..-1]} #{f}
- end
- code
+ def create_aliases l, fcts
+ module_eval <<-code
+ class << self
+ #{fcts.map{ |f,a,r| "alias #{f.to_s[l..-1]} #{f}" }.join "\n" }
end
+ code
end
end
#