Posted By: Jeff Wood
Date: 2005-10-18 06:20
Summary: Roxy 0.1
Project: Roxy
Roxy is an implementation of clean/transparent proxy objects.
It has features including Type/Method list impersonation & even allows remote blocks.
Here is a sample of usage for it server & client sides:
-- SCRIPT: server.rb --
require 'roxy'
my_array = [ 1, 2, 3, 4, 5 ]
server = RoxyServer.new( "hostname", 4242, my_array )
trap( "INT" ) { server.stop_server }
server.start_server.join
-- END: SCRIPT --
-- SCRIPT: client.rb --
require 'roxy'
obj = Roxy.new( "hostname", 4242 )
obj.class #=> Array
obj.methods # returns list of Array instance methods
obj.map { |c| c*2 } #=> [ 2, 4, 6, 8, 10 ]
-- END: SCRIPT --
Additional features I plan to implement include allowing for ANY Socket object to act as medium for communication, that way people can override it with whatever protocols they would like to use.
A known limitation is that ONLY the first call of a chain ( obj.call.call.call ) will be executed remotely, the rest will be executed locally on the result values.
Again, your feedback is very much appreciated.
j. |
|