Skip to content

Instantly share code, notes, and snippets.

@suhanlee
Created October 21, 2017 05:03
Show Gist options
  • Save suhanlee/05f09389dcfd6539f0d2ee2e6f2a7768 to your computer and use it in GitHub Desktop.
Save suhanlee/05f09389dcfd6539f0d2ee2e6f2a7768 to your computer and use it in GitHub Desktop.
drb_example
require 'drb/drb'
require 'pp'
obj = DRbObject.new_with_uri('druby://localhost:1234')
pp obj
pp obj.to_a
pp obj.to_single
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