class Barrister::InterfaceProxy
Internal class used by the Client
and BatchClient
classes
Each instance represents a proxy for a single interface in the IDL, and will contain a method for each function in the interface.
These proxy methods call ‘Client.request` when invoked
Public Class Methods
new(client, iface)
click to toggle source
# File lib/barrister.rb, line 545 def initialize(client, iface) singleton = class << self; self end iface.functions.each do |f| method = iface.name + "." + f.name singleton.send :define_method, f.name do |*args| resp = client.request(method, args) if client.trans.instance_of? BatchTransport return nil else if resp.key?("result") return resp["result"] else err = resp["error"] raise RpcException.new(err["code"], err["message"], err["data"]) end end end end end