diff options
author | Jérémy Zurcher <jeremy@asynk.ch> | 2011-05-08 01:58:57 +0200 |
---|---|---|
committer | Jérémy Zurcher <jeremy@asynk.ch> | 2011-05-08 01:58:57 +0200 |
commit | 0f86ef56c6e4c044983a52946c1e7a81a2ee9349 (patch) | |
tree | 0bfb3b6e3f5602d3bee757afd363c7979034b595 | |
parent | 3e027876802e788a094707c163d529a46ec51c1c (diff) | |
download | ffi-efl-0f86ef56c6e4c044983a52946c1e7a81a2ee9349.zip ffi-efl-0f86ef56c6e4c044983a52946c1e7a81a2ee9349.tar.gz |
add ClassHelper #to_a, #to_ary, #to_s
-rw-r--r-- | lib/efl/ffi.rb | 4 |
1 files changed, 3 insertions, 1 deletions
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 |