def define_method_from_descriptor(m)
check_for_eval(m.name)
check_for_quoted_eval(@name)
methdef = "def #{m.name}("
methdef += (0..(m.params.size - 1)).to_a.collect { |n|
"arg#{n}"
}.push("&reply_handler").join(", ")
methdef += %{)
msg = Message.new(Message::METHOD_CALL)
msg.path = @object.path
msg.interface = "#{@name}"
msg.destination = @object.destination
msg.member = "#{m.name}"
msg.sender = @object.bus.unique_name
}
idx = 0
m.params.each do |fpar|
par = fpar.type
check_for_quoted_eval(par)
Type::Parser.new(par).parse
methdef += %{
msg.add_param("#{par}", arg#{idx})
}
idx += 1
end
methdef += "
@object.bus.send_sync_or_async(msg, &reply_handler)
end
"
singleton_class.class_eval(methdef)
@methods[m.name] = m
end