[SWIG] Dynamic method dispatching with "send"

  • Thread starter Esteban Manchado Velázquez
  • Start date
E

Esteban Manchado Velázquez

Hi all,

Perhaps this is a stupid question, but I don't know enough SWIG yet:

Can't I use the "send" method for dynamic method dispatching? I'm curr=
ently
writing my first attempt at a Ruby interface, with SWIG, and I can't get
"send" to work.

The scenario is:

-------------------------------- 8< --------------------------------
class OutChannel
def create_ice(options=3D{})
ice =3D get_ice(orig_create_ice)
puts ice.class
[:host, :port].each do |opt|
ice.send(opt, options[opt]) if options.has_key? opt
end
ice.apply_profile
ice
end
end
-------------------------------- >8 --------------------------------

When "send" is called, it raises this exception:

TypeError: wrong argument type Symbol (expected Data)

I even redefined "send", to check parameters and make sure it was calling=
the
method I thought, but everything seems OK:

-------------------------------- 8< --------------------------------
class Shouter
alias_method :eek:ld_send, :send
def send(meth, *args)
puts "parameters: #{meth}, #{args.join(', ')}"
old_send(meth, *args)
end
end
-------------------------------- >8 --------------------------------

The result, then, is:

-------------------------------- 8< --------------------------------
parameters: host, corintio
TypeError: wrong argument type Symbol (expected Data)
-------------------------------- >8 --------------------------------

I can send complete sources, although I guess it's nothing specific of my
code.

Any ideas why it doesn't work? It works with "method", though :-? I'm
clueless...

Regards,

--=20
Esteban Manchado Vel=E1zquez <[email protected]> - http://www.foton.es
EuropeSwPatentFree - http://EuropeSwPatentFree.hispalinux.es
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Similar Threads


Members online

No members online now.

Forum statistics

Threads
473,764
Messages
2,569,564
Members
45,040
Latest member
papereejit

Latest Threads

Top