lib/universa/service.rb in universa-0.1.5 vs lib/universa/service.rb in universa-0.1.6
- old
+ new
@@ -12,11 +12,11 @@
# Setup service initial parameters
def initialize
@config = SmartHash.new path: nil
@known_proxies = {}
- [Contract, PrivateKey, PublicKey, KeyAddress].each {|klass| register_proxy klass}
+ [Contract, PrivateKey, PublicKey, KeyAddress, Binder, Role, ChangeOwnerPermission].each {|klass| register_proxy klass}
end
# Implementation of {Service.configure}
def configure &block
raise Error, "config call must happen before interface creation" if @umi
@@ -90,11 +90,11 @@
@remote = args[0].ref
else
# User called constructor
remote_class_name = self.class.remote_class_name
remote_class_name&.length or raise Error, "provide remote_class_name"
- @remote = Service.umi.instantiate remote_class_name.split('.')[-1], *args, adapter: self
+ @remote = Service.umi.instantiate remote_class_name, *args, adapter: self
end
end
# Delegated object
# @return [Ref] the wrapped instance whose methpds are delegated by this
@@ -117,17 +117,17 @@
#
# Notice: remote_class will do allnecessary work for you.
#
# @return [String] remote class name
def self.remote_class_name
- raise Error, "provde remote class name"
+ @remote_class_name or raise Error, "provde remote class name"
end
# Registers remote class name to be used with this adapted. Call it early in descendant class
# declaration.
def self.remote_class name
- class_eval "def self.remote_class_name; '#{name}'; end"
+ @remote_class_name = name
end
# debugging label
def inspect
"<#{self.class.name}:#{__id__}:#{@remote._remote_class_name}:#{@remote._remote_id}}>"
@@ -135,9 +135,13 @@
# call the remote toString(). Does not cache it.
# @return [String]
def to_s
toString()
+ end
+
+ def self.invoke_static(method_name, *args)
+ Service.umi.invoke_static @remote_class_name, method_name, *args
end
end
end