summaryrefslogtreecommitdiffstats
path: root/lib/efl/evas.rb
diff options
context:
space:
mode:
authorJérémy Zurcher <jeremy@asynk.ch>2012-02-27 11:37:06 +0100
committerJérémy Zurcher <jeremy@asynk.ch>2012-02-27 11:37:06 +0100
commit7603f4c0902bf5845c7e7654c3745f5519347c8b (patch)
treebd381bf3a7f04d2ee7ddd92111c35a03472c7ecf /lib/efl/evas.rb
parent8c013976d73850718e75bbc93a03f3f016fc3ae8 (diff)
downloadffi-efl-7603f4c0902bf5845c7e7654c3745f5519347c8b.zip
ffi-efl-7603f4c0902bf5845c7e7654c3745f5519347c8b.tar.gz
use instance_eval instead of yield self.
- simplify and highlights initialization code - but shadows external scope variables
Diffstat (limited to 'lib/efl/evas.rb')
-rw-r--r--lib/efl/evas.rb12
1 files changed, 6 insertions, 6 deletions
diff --git a/lib/efl/evas.rb b/lib/efl/evas.rb
index 613b72b..e65a710 100644
--- a/lib/efl/evas.rb
+++ b/lib/efl/evas.rb
@@ -58,7 +58,7 @@ module Efl
include Efl::ClassHelper
search_prefixes 'evas_'
#
- def initialize o=nil
+ def initialize o=nil, &block
@ptr = (
case o
when NilClass
@@ -69,7 +69,7 @@ module Efl
raise ArgumentError.new "wrong argument #{o.class.name}"
end
)
- yield self if block_given?
+ instance_eval &block if block
end
def self.release p
Native.evas_free p
@@ -133,7 +133,7 @@ module Efl
include Efl::ClassHelper
search_prefixes 'evas_object_', 'evas_'
#
- def initialize a, *args
+ def initialize a, *args, &block
@ptr = (
case a
when FFI::Pointer
@@ -144,7 +144,7 @@ module Efl
raise ArgumentError.new "wrong argument #{a.class.name}"
end
)
- yield self if block_given?
+ instance_eval &block if block
end
def self.release p
Native.evas_object_del p unless p.nil?
@@ -161,9 +161,9 @@ module Efl
REvasObject.release @ptr
@ptr=nil
end
- def object_box_add
+ def object_box_add &block
o = Evas::REvasBox.new FFI::AutoPointer.new Native.evas_object_box_add_to(@ptr), REvasObject.method(:release)
- yield o if block_given?
+ o.instance_eval &block if block
o
end
def evas_name