lib/culerity/remote_object_proxy.rb in caius-culerity-0.1.6 vs lib/culerity/remote_object_proxy.rb in caius-culerity-0.1.7
- old
+ new
@@ -11,19 +11,25 @@
def initialize(remote_object_id, io)
@remote_object_id = remote_object_id
@io = io
end
+ #
# Commonly used to get the HTML id attribute
# Use `object_id` to get the local objects' id.
+ #
def id
send_remote(:id)
end
def method_missing(name, *args)
send_remote(name, *args)
end
+ #
+ # Calls the passed method on the remote object with any arguments specified.
+ # Behaves the same as <code>Object#send</code>.
+ #
def send_remote(name, *args)
@io << "[#{remote_object_id}, \"#{name}\", #{args.map{|a| a.inspect}.join(', ')}]\n"
process_result @io.gets.to_s.strip
end
\ No newline at end of file