Call Erlang from Ruby

2019-05-04 18:59发布

问题:

What is the most awesome gem I should use to call Erlang functions from Ruby app? I wish to use rspec for testing some gen_server stuff.

Erlectricity looking solid, but there is no something like Node#rpc, just message passing. Any ideas?

回答1:

Well. I am using BERT-RPC and happy with it.

http://github.com/mojombo/bertrpc



回答2:

For rpc calls, rinterface might be the right option. From the README:

r = Erlang::Node.rpc("math","math_server","add",[10,20])
if r[0] == :badrpc
   puts "Got and Error. Reason #{r[1]}"
else
   puts "Success: #{r[1]}"
end


回答3:

I think (someone prove me wrong) that you shouldn't use rspec for a gen_server at all. Instead you could, depening on what your gen_server actually does, use eunit. http://salientblue.com/codenotes/?name=erl_start and no, its a long way from rspec.



标签: ruby erlang