module PIM::Services
Constants
- DISABLED_EXTERNAL_SERVICES
Public Class Methods
__cache()
click to toggle source
# File services.rb, line 113 def self.__cache PIM.__fiber_local_cache(:__service_cache) end
__cached(cache_id, &loader)
click to toggle source
# File services.rb, line 117 def self.__cached cache_id, &loader value = __cache[cache_id] return value unless value.nil? value = loader.call __cache[cache_id] = value value end
__convert(value, to:, array: false, force: false)
click to toggle source
# File services.rb, line 129 def self.__convert value, to:, array: false, force: false return nil if value.nil? if array and PIM::Utils.is_array?(value) return value.map { |v| __convert(v, to: to, force: force) } end if PIM::Utils.is_java_object?(value) # Try to convert to json, if possible if force and value.respond_to?(:toJson) json = JSON.parse(value.toJson) return __convert(json, to: to) end return value end # Convert to new class if PIM::Utils.is_hash?(value) return to.new(value) end return value end
__external_service(name)
click to toggle source
# File services.rb, line 172 def self.__external_service name return nil unless ProxyService.has_external_service? return nil unless ::Object.private_method_defined?(:__external_service_provider) return __external_service_provider(name.to_s) end
__proxy_service(name, force: false)
click to toggle source
# File services.rb, line 158 def self.__proxy_service name, force: false return nil unless (force or ProxyService.has_service?(name)) @@__proxy_services ||= {} service = @@__proxy_services[name.to_s] if service.nil? service = ProxyService.new(name.to_s) @@__proxy_services[name.to_s] = service end service end
__remove_from_cache(value)
click to toggle source
# File services.rb, line 125 def self.__remove_from_cache value __cache.delete(value) end
is_external_services_available?()
click to toggle source
# File services.rb, line 105 def self.is_external_services_available? return ProxyService.has_external_service? end
is_java_services_available?()
click to toggle source
# File services.rb, line 109 def self.is_java_services_available? return ProxyService.has_java_service? end
is_services_available?()
click to toggle source
# File services.rb, line 101 def self.is_services_available? return (is_external_services_available? or is_java_services_available?) end