module PipeRpc class Mapper; end class Hub::TransportMapper < Mapper def initialize(gateway) @gateway = gateway end def to_transport(object) map(object) do |value| if value.respond_to? :to_rpc_transport value.to_rpc_transport(@gateway) else value end end end def from_transport(object) map(object) do |value| if (value.is_a? String) and (value.start_with? Client::TRANSPORT_PREFIX) Server.from_rpc_transport(@gateway, value) elsif (value.is_a? String) and (value.start_with? Server::TRANSPORT_PREFIX) Client.from_rpc_transport(@gateway, value) else value end end end end end