Created
June 30, 2009 17:13
-
-
Save seki/138274 to your computer and use it in GitHub Desktop.
This file contains 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 'drb/drb' | |
ro = DRbObject.new_with_uri(ARGV.shift) | |
name = 'your_nick' | |
url = 'http://your_page' | |
desc = 'your comment' | |
p ro.exchange(name, url, desc) |
This file contains 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 'rinda/tuplespace' | |
module Rinda | |
class Njet | |
def initialize(value) | |
@value = value | |
end | |
def ===(other) | |
@value != other | |
end | |
end | |
end | |
class CardHolder | |
def initialize | |
@ts = Rinda::TupleSpace.new | |
@ts.write(['m_seki', 'http://d.hatena.ne.jp/m_seki', 'Hello, Again']) | |
end | |
def exchange(name, url, desc) | |
@ts.write([name, url, desc]) | |
@ts.take([Rinda::Njet.new(name), nil, nil]) | |
end | |
end | |
DRb.start_service('druby://:56789', CardHolder.new) | |
puts DRb.uri | |
DRb.thread.join |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment