Skip to content

jono-booth/drubytut

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commit
 
 
 
 
 
 
 
 

Repository files navigation

Basic DRb Example

What is DRb?

Distributed Ruby or DRb allows Ruby programs to communicate with each other on the same machine or over a network. DRb uses remote method invocation to pass commands and data between processes.

Rock, paper scissor game tutorial

  1. Open up a new terminal window.

  2. Start the Game server. (View Source)

$ ruby game_server.rb druby://localhost:8787
  1. Open up a second terminal window.

  2. Open an IRB session.

$ irb --prompt simple -I . -r game.rb -r drb/drb
  1. Connect to the Game server and start a new game.
>> game = Game.new
>> game.server_uri = 'druby://localhost:8787'
  1. Play the game against the machine. (View Source)
>> game.play('rock')

#=> "Computer plays Paper - You Lose!"

About

Distributed Ruby Examples

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages