erlectricity
by Scott Fleckenstein
Tom Preston-Werner
http://github.com/mojombo/erlectricity
== DESCRIPTION:
Erlectricity allows a Ruby program to receive and respond to Erlang messages
sent over the Erlang binary protocol.
== INSTALL:
$ gem install erlectricity
== USAGE (Ruby side):
require 'rubygems'
require 'erlectricity'
require 'stringio'
receive do |f|
f.when(:echo, String) do |text|
f.send!(:result, "You said: #text")
f.receive_loop
end
end
== USAGE (Erlang side):
-module(echo).
-export([test/0]).
test() ->
Cmd = "ruby echo.rb",
Port = open_port(Cmd, [4, use_stdio, exit_status, binary]),
Payload = term_to_binary(<<"hello world!">>),
port_command(Port, Payload),
receive
{data, Data} ->
Text = binary_to_term(Data),
io:format("~p~n", [Text])
end.
by Scott Fleckenstein
Tom Preston-Werner
http://github.com/mojombo/erlectricity
== DESCRIPTION:
Erlectricity allows a Ruby program to receive and respond to Erlang messages
sent over the Erlang binary protocol.
== INSTALL:
$ gem install erlectricity
== USAGE (Ruby side):
require 'rubygems'
require 'erlectricity'
require 'stringio'
receive do |f|
f.when(:echo, String) do |text|
f.send!(:result, "You said: #text")
f.receive_loop
end
end
== USAGE (Erlang side):
-module(echo).
-export([test/0]).
test() ->
Cmd = "ruby echo.rb",
Port = open_port(Cmd, [4, use_stdio, exit_status, binary]),
Payload = term_to_binary(<<"hello world!">>),
port_command(Port, Payload),
receive
{data, Data} ->
Text = binary_to_term(Data),
io:format("~p~n", [Text])
end.