From de61814d34c6fe52233ca2e61bd97d0ba18bea17 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=A9r=C3=A9my=20Zurcher?= Date: Sat, 7 May 2011 12:52:10 +0200 Subject: cleanup REvasObject#initialize --- lib/efl/evas.rb | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) diff --git a/lib/efl/evas.rb b/lib/efl/evas.rb index 7f0fd8b..560cc49 100644 --- a/lib/efl/evas.rb +++ b/lib/efl/evas.rb @@ -125,17 +125,15 @@ module Efl include Efl::ClassHelper search_prefixes 'evas_object_', 'evas_' # - def initialize *args + def initialize a, *args @ptr = ( - case args[0] - when NilClass - FFI::AutoPointer.new Native.evas_new, REvasObject.method(:release) + case a when FFI::Pointer - args[0] + a when Method - FFI::AutoPointer.new args[0].call(args[1]), REvasObject.method(:release) + FFI::AutoPointer.new a.call(*args), REvasObject.method(:release) else - raise ArgumentError.new "wrong argument #{args[0].class.name}" + raise ArgumentError.new "wrong argument #{a.class.name}" end ) yield self if block_given? -- cgit v1.1-2-g2b99