| CARVIEW |
Select Language
HTTP/2 302
server: nginx
date: Wed, 24 Dec 2025 05:34:24 GMT
content-type: text/plain; charset=utf-8
content-length: 0
x-archive-redirect-reason: found capture at 20090817161658
location: https://web.archive.org/web/20090817161658/https://github.com/mojombo/erlectricity/tree/master
server-timing: captures_list;dur=0.535729, exclusion.robots;dur=0.046593, exclusion.robots.policy;dur=0.038246, esindex;dur=0.008857, cdx.remote;dur=13.301548, LoadShardBlock;dur=384.611835, PetaboxLoader3.datanode;dur=255.345131, PetaboxLoader3.resolve;dur=101.539971
x-app-server: wwwb-app224-dc8
x-ts: 302
x-tr: 422
server-timing: TR;dur=0,Tw;dur=0,Tc;dur=0
set-cookie: wb-p-SERVER=wwwb-app224; path=/
x-location: All
x-as: 14061
x-rl: 0
x-na: 0
x-page-cache: MISS
server-timing: MISS
x-nid: DigitalOcean
referrer-policy: no-referrer-when-downgrade
permissions-policy: interest-cohort=()
HTTP/2 200
server: nginx
date: Wed, 24 Dec 2025 05:34:25 GMT
content-type: text/html; charset=utf-8
x-archive-orig-server: nginx/0.6.31
x-archive-orig-date: Mon, 17 Aug 2009 16:16:57 GMT
x-archive-orig-connection: close
x-archive-orig-status: 200 OK
x-archive-orig-x-runtime: 699ms
x-archive-orig-etag: "0f8b1841f262af5d74658677237154c3"
x-archive-orig-cache-control: private, max-age=0, must-revalidate
x-archive-orig-content-length: 28691
x-archive-guessed-content-type: text/html
x-archive-guessed-charset: utf-8
memento-datetime: Mon, 17 Aug 2009 16:16:58 GMT
link: ; rel="original", ; rel="timemap"; type="application/link-format", ; rel="timegate"
content-security-policy: default-src 'self' 'unsafe-eval' 'unsafe-inline' data: blob: archive.org web.archive.org web-static.archive.org wayback-api.archive.org athena.archive.org analytics.archive.org pragma.archivelab.org wwwb-events.archive.org
x-archive-src: 52_11_20090817134821_crawl101.gpg-c/52_11_20090817161545_crawl101.arc.gz
server-timing: captures_list;dur=0.706126, exclusion.robots;dur=0.022094, exclusion.robots.policy;dur=0.010526, esindex;dur=0.012432, cdx.remote;dur=16.481156, LoadShardBlock;dur=186.357682, PetaboxLoader3.resolve;dur=299.400378, PetaboxLoader3.datanode;dur=209.545494, load_resource;dur=347.438951
x-app-server: wwwb-app224-dc8
x-ts: 200
x-tr: 618
server-timing: TR;dur=0,Tw;dur=0,Tc;dur=0
x-location: All
x-as: 14061
x-rl: 0
x-na: 0
x-page-cache: MISS
server-timing: MISS
x-nid: DigitalOcean
referrer-policy: no-referrer-when-downgrade
permissions-policy: interest-cohort=()
content-encoding: gzip
mojombo's erlectricity at master - GitHub
This repository is private.
All pages are served over SSL and all pushing and pulling is done over SSH.
No one may fork, clone, or view it unless they are added as a member.
Every repository with this icon (
) is private.
Every repository with this icon (
This repository is public.
Anyone may fork, clone, or view it.
Every repository with this icon (
) is public.
Every repository with this icon (
Run the following if you haven't already:
gem sources -a https://gems.github.com
Install the gem(s):
sudo gem install mojombo-erlectricity
| Description: | Erlectricity exposes Ruby to Erlang and vice versa. edit |
| Homepage: | edit |
| Public Clone URL: |
git://github.com/mojombo/erlectricity.git
Give this clone URL to anyone.
git clone git://github.com/mojombo/erlectricity.git
|
| Your Clone URL: |
Use this clone URL yourself.
git clone git@github.com:mojombo/erlectricity.git
|
Tom Preston-Werner (author)
Wed Jun 03 15:59:36 -0700 2009
| name | age | message | |
|---|---|---|---|
| |
.gitignore | Loading commit data... |
|
| |
History.txt | Wed Jun 03 15:59:24 -0700 2009 | update history.txt [Tom Preston-Werner] |
| |
LICENSE | Sun Apr 26 10:49:12 -0700 2009 | add license [Tom Preston-Werner] |
| |
README.md | ||
| |
Rakefile | Mon Apr 27 23:18:34 -0700 2009 | Erlectricity::Decoder.read_any_from -> Erlectri... [Tom Preston-Werner] |
| |
VERSION.yml | ||
| |
benchmarks/ | ||
| |
erlectricity.gemspec | Wed Jun 03 15:59:36 -0700 2009 | Regenerated gemspec for version 1.0.2 [Tom Preston-Werner] |
| |
examples/ | ||
| |
ext/ | ||
| |
lib/ | Wed Jun 03 15:16:31 -0700 2009 | Work around Ruby's reluctance to convert the em... [bwbuchanan] |
| |
test/ |
README.md
Erlectricity
https://github.com/mojombo/erlectricity
By Scott Fleckenstein, Tom Preston-Werner
Development Status: Production/Stable
Description
Erlectricity allows a Ruby program to receive and respond to Erlang messages sent over the Erlang binary protocol.
Install
$ gem install erlectricity
-or-
$ gem install mojombo-erlectricity -s https://gems.github.com
The Simplest Example
Ruby side (echo.rb)
require 'rubygems'
require 'erlectricity'
receive do |f|
f.when([:echo, String]) do |text|
f.send!([:result, "You said: #{text}"])
f.receive_loop
end
end
Erlang side (echo.erl)
-module(echo).
-export([test/0]).
test() ->
Cmd = "ruby echo.rb",
Port = open_port({spawn, Cmd}, [{packet, 4}, nouse_stdio, exit_status, binary]),
Payload = term_to_binary({echo, <<"hello world!">>}),
port_command(Port, Payload),
receive
{Port, {data, Data}} ->
{result, Text} = binary_to_term(Data),
io:format("~p~n", [Text])
end.
Data Type Conversions and Matching
% Port is the port opened via open_port({spawn, Cmd}, [{packet, 4}, ...])
% Message is the Erlang term to encode and send to the port
send(Port, Message) ->
port_command(Port, term_to_binary(Message)).
# Each triplet below represents:
# (line 1) the Erlang call
# (line 2) the Ruby matcher
# (line 3) the Ruby output
send(Port, test).
f.when(:test) { p :ok }
# :ok
send(Port, {atom, symbol}).
f.when([:atom, Symbol]) { |sym| p sym }
# :symbol
send(Port, {number, 1}).
f.when([:number, Fixnum]) { |num| p num }
# 1
send(Port, {string, <<"foo">>}).
f.when([:string, String]) { |str| p str }
# "foo"
send(Port, {array, [1,2,3]}).
f.when([:array, Array]) { |arr| p arr }
# [1, 2, 3]
send(Port, {array, [<<"abc">>, <<"def">>]}).
f.when([:array, Array]) { |arr| p arr }
# ["abc", "def"]
send(Port, {hash, [{key,val}]}).
f.when([:hash, Erl.hash]) { |hash| p hash }
# {:key=>:val}
send(Port, {object, {1,{2},3,<<"four">>}}).
f.when([:object, Any]) { |any| p any }
# [1, [2], 3, "four"]
Contribute
If you'd like to hack on Erlectricity, start by forking my repo on GitHub:
https://github.com/mojombo/erlectricity
To get all of the dependencies, install the gem first. The best way to get your changes merged back into core is as follows:
- Clone down your fork
- Create a topic branch to contain your change
- Hack away
- Add tests and make sure everything still passes by running
rake - If you are adding new functionality, document it in the README.md
- Do not change the version number, I will do that on my end
- If necessary, rebase your commits into logical chunks, without errors
- Push the branch up to GitHub
- Send me (mojombo) a pull request for your branch
Copyright
Copyright (c) 2009 Scott Fleckenstein and Tom Preston-Werner. See LICENSE for details.
This feature is coming soon. Sit tight!












