Class: Hypertube::Sdk::Configuration::ConfigResolvers::ConfigResolver
- Inherits:
-
Object
- Object
- Hypertube::Sdk::Configuration::ConfigResolvers::ConfigResolver
show all
- Defined in:
- lib/hypertube-ruby-sdk/sdk/configuration/config_resolvers/config_resolver.rb
Class Method Summary
collapse
Class Method Details
.build_connection_data(host_value) ⇒ Object
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
|
# File 'lib/hypertube-ruby-sdk/sdk/configuration/config_resolvers/config_resolver.rb', line 21
def self.build_connection_data(host_value)
if host_value.nil? || host_value.strip.empty?
raise 'Host value cannot be null or whitespace.'
end
hv = host_value.strip
lower = hv.downcase
if %w[inmemory in-memory].include?(lower)
return nil end
return Hypertube::Utils::WsConnectionData.new(hv) if lower.start_with?('ws://') || lower.start_with?('wss://')
if((lower.start_with?('http://') && lower.end_with?('h2')) || (lower.start_with?('https://') && lower.end_with?('h2')))
return Hypertube::Utils::Http2ConnectionData.new(hv)
end
if lower.start_with?('tcp://') || hv.include?(':')
return Hypertube::Utils::TcpConnectionData.new(hv)
end
raise "Host value '#{hv}' is not a recognized connection format."
end
|
.try_parse_runtime(runtime) ⇒ Object
14
15
16
17
18
19
|
# File 'lib/hypertube-ruby-sdk/sdk/configuration/config_resolvers/config_resolver.rb', line 14
def self.try_parse_runtime(runtime)
raise 'Runtime string cannot be null or whitespace.' if runtime.nil? || runtime.strip.empty?
runtime = runtime.strip.downcase
Hypertube::Utils::RuntimeNameHandler.get_runtime(runtime)
end
|