examples/tinderl/tinderl.rb in mojombo-erlectricity-0.2.1 vs examples/tinderl/tinderl.rb in mojombo-erlectricity-1.0.0
- old
+ new
@@ -1,27 +1,28 @@
-$:.unshift(File.dirname(__FILE__) + "/../../lib/")
-require 'erlectricity'
+$:.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.when([:speak, Any]) do |comment|
+ room.speak(comment)
f.receive_loop
- end
-
- f.when(:paste, Any) do |comment|
- room.paste comment
+ end
+
+ f.when([:paste, Any]) do |comment|
+ room.paste(comment)
f.receive_loop
end
-
+
f.when(Any) do |obj|
- STDERR.write obj.inspect
+ p obj
end
end
room.leave if room