Created
June 18, 2012 13:42
-
-
Save adamgamble/2948434 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| require 'rubygems' | |
| require 'dcell' | |
| class TimeServer | |
| include Celluloid | |
| def time | |
| "The time is: #{Time.now}" | |
| end | |
| end | |
| class FileServer | |
| include Celluloid | |
| SHARE_DIRECTORY = File.join(File.expand_path(File.dirname(__FILE__)), "share") | |
| def list | |
| Dir.entries(SHARE_DIRECTORY) | |
| end | |
| def read(file_name = "") | |
| File.read(File.join(SHARE_DIRECTORY, file_name)) | |
| end | |
| end | |
| DCell.start :id => "desktop", :addr => "tcp://192.168.1.74:2042" | |
| TimeServer.supervise_as :time_server | |
| FileServer.supervise_as :file_server | |
| while true do | |
| sleep 1 | |
| end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment