Created
October 21, 2017 05:03
-
-
Save suhanlee/05f09389dcfd6539f0d2ee2e6f2a7768 to your computer and use it in GitHub Desktop.
drb_example
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 'drb/drb' | |
require 'pp' | |
obj = DRbObject.new_with_uri('druby://localhost:1234') | |
pp obj | |
pp obj.to_a | |
pp obj.to_single |
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 'drb/drb' | |
require 'pp' | |
class Sample | |
def initialize(single, multi) | |
@single = single | |
@multi = multi | |
end | |
def to_a | |
@multi | |
end | |
def to_single | |
@single | |
end | |
end | |
sample = Sample.new(7, [1, 2, 3, 4, 5]) | |
DRb.start_service('druby://localhost:1234', sample) | |
while true | |
sleep 10 | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment