lib/moleculer/node.rb in moleculer-0.2.0 vs lib/moleculer/node.rb in moleculer-0.3.0
- old
+ new
@@ -26,11 +26,11 @@
@hostname = options.fetch(:hostname, Socket.gethostname)
svcs = options.fetch(:services)
# TODO: move this up to from_remote_info
svcs.map! { |service| Service.from_remote_info(service, self) } if svcs.first.is_a? Hash
- @services = Hash[svcs.map { |s| [s.service_name, s] }]
+ @services = Hash[svcs.map { |s| [s.full_name, s] }]
end
def register_service(service)
@services[service.name] = service
end
@@ -79,17 +79,17 @@
def local?
@local
end
- def as_json
+ def to_h
{
sender: @id,
config: {},
seq: 1,
ipList: [],
hostname: @hostname,
- services: @services.values.map(&:as_json),
+ services: @services.values.map(&:to_h),
client: client_attrubutes,
}
end
private