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, ort].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 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
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, ort].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 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