diff options
Diffstat (limited to 'lib/efl/native/ecore_getopt.rb')
-rw-r--r-- | lib/efl/native/ecore_getopt.rb | 25 |
1 files changed, 23 insertions, 2 deletions
diff --git a/lib/efl/native/ecore_getopt.rb b/lib/efl/native/ecore_getopt.rb index e92b4da..feb74e8 100644 --- a/lib/efl/native/ecore_getopt.rb +++ b/lib/efl/native/ecore_getopt.rb @@ -8,8 +8,29 @@ module Efl module EcoreGetopt # def self.method_missing m, *args, &block - sym = 'ecore_getopt_'+m.to_s - raise NameError.new "#{self.name}.#{sym} (#{m})" if not Efl::Native.respond_to? sym + m_s = m.to_s + if m_s =~/^(.*)=$/ + m_s = $1+'_set' + args_s = '*args[0]' + elsif m_s =~/^(.*)\?$/ + m_s = $1+'_get' + args_s = '*args' + else + args_s = '*args' + end + sym = ( + if Efl::Native.respond_to? 'ecore_getopt_'+m_s + 'ecore_getopt_'+m_s + elsif Efl::Native.respond_to? m_s + m_s + elsif Efl::Native.respond_to? 'ecore_getopt_'+m_s+'_get' + 'ecore_getopt_'+m_s+'_get' + elsif Efl::Native.respond_to? m_s+'_get' + m_s+'_get' + else + raise NameError.new "#{self.name}.#{m_s} (#{m})" + end + ) self.module_eval "def self.#{m} *args, █ r=Efl::Native.#{sym}(*args); yield r if block_given?; r; end" self.send m, *args, &block end |