lib/aerospike/host/parse.rb
# Extract addr, tls_name and port components from a host strin
Extract addr, tls_name and port components from a host strin
Extract addr tls_name and port components from a host strin
def components(host_string)
          host_string = host_string.strip
          if host_string.start_with?('[')
            end_idx = host_string.index(']')
            raise ::Aerospike::Exceptions::Parse, 'Invalid IPv6 host' if end_idx.nil?
            host_string.slice(end_idx+1..-1).split(':').tap do |result|
              result[0] = host_string[1...end_idx]
            end
          else
            host_string.split(?:)
          end
        end
def components ( host_string ) host_string = host_string . strip if host_string . start_with? ( '[' ) end_idx = host_string . index ( ']' ) raise :: Aerospike :: Exceptions :: Parse , 'Invalid IPv6 host' if end_idx . nil? host_string . slice ( end_idx + 1 .. - 1 ) . split ( ':' ) . tap do | result | result [ 0 ] = host_string [ 1 ... end_idx ] end else host_string . split ( ?: ) end end
Extract addr, tls_name and port components from a host strin
Extract addr tls_name and port components from a host strin
# IPv6 # Slice away brackets and what's inside them, then split on : and # replace first entry with string inside brackets
host_string