From 0f86ef56c6e4c044983a52946c1e7a81a2ee9349 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=A9r=C3=A9my=20Zurcher?= Date: Sun, 8 May 2011 01:58:57 +0200 Subject: add ClassHelper #to_a, #to_ary, #to_s --- lib/efl/ffi.rb | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/lib/efl/ffi.rb b/lib/efl/ffi.rb index fe2ec78..05c9cbd 100644 --- a/lib/efl/ffi.rb +++ b/lib/efl/ffi.rb @@ -68,6 +68,9 @@ module Efl end # module ClassHelper + def to_a; [self] end + def to_ary; [self] end + def to_s; Object.instance_method(:to_s).bind(self).call+' ['+self.to_ptr.to_s+']' end def to_ptr; @ptr; end def === o; @ptr === o.to_ptr; end def address; @ptr.address; end @@ -115,7 +118,6 @@ module Efl return self.send m, *args, &block end end - return [self.to_s+' ['+self.to_ptr.to_s+']'] if m_s=~/^to_ary$/ Kernel.raise NameError.new "#{self.class.name} is unable to resolve #{m} within #{self.class.search_prefixes.inspect}" end end -- cgit v1.1-2-g2b99