Remote Ruby

Project Page

Remote Ruby is a dead-simple remote procedure call framework implemented in pure Ruby. Its purpose is to easily expose object methods to external apps or make objects invocable over the net. It uses a simply defined protocol over TCP to identify and invoke objects and classes registered on the server, and uses YAML to marshal parameters and return values. Remote objects act just like ruby objects and can be used anywhere as such.

SVN Access

Remote Ruby can be downloaded via Subversion using the following command:

svn co http://remote-ruby.rubyforge.org/svn/trunk

Code Sample

Server Code
class MyClass
  def say_hello
    puts "Hello, World!"
  end
  def send_message(message)
    puts message
  end
  def calculate_something(val)
    val+4
  end
end

require 'remote-ruby/server'
rs = RemoteRuby::Server.new(123456)
rs.register(MyClass)
Client Code
require 'remote-ruby/client'
# To run this on two different machines, replace 'localhost' with the hostname or IP of the box running the server code.
rc = RemoteRuby::Client.new('localhost',123456)  
my_class = rc.remote_class('MyClass')
object = my_class.new
object.say_hello                                 # Outputs "Hello, World!" on the server
object.send_message 'From the client script!'    # Outputs "From the client script!" on the server
puts object.calculate_something(10)              # Outputs "14" on the client