mojombo / erlectricity

Erlectricity exposes Ruby to Erlang and vice versa.

erlectricity / examples / tinderl / tinderl.rb
100644 29 lines (22 sloc) 0.532 kb
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
$:.unshift File.join(File.dirname(__FILE__), *%w[../../lib])
 
require 'rubygems'
require 'erlectricity'
require 'tinder'
 
domain, email, password, room_name = *ARGV
campfire = Tinder::Campfire.new domain
campfire.login email, password
room = campfire.find_room_by_name room_name
 
receive do |f|
  f.when([:speak, Any]) do |comment|
    room.speak(comment)
    f.receive_loop
  end
 
  f.when([:paste, Any]) do |comment|
    room.paste(comment)
    f.receive_loop
  end
 
  f.when(Any) do |obj|
    p obj
  end
end
 
room.leave if room