diff options
Diffstat (limited to 'lib/e17')
-rw-r--r-- | lib/e17/ffi_helper.rb | 16 |
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 # |