Method: QRPC::Locator.parse

Defined in:
lib/qrpc/locator.rb

.parse(string) ⇒ QRPC::Locator

Parses the locator. Excpects form <queue>@<host>:<port>. Port is optional.

Parameters:

  • string (String)

    locator in string form

Returns:



74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
# File 'lib/qrpc/locator.rb', line 74

def self.parse(string)
    match = string.match(self::PARSER)
    
    queue = match[1]
    host = match[2]
    
    if match.length == 3
        port = match[3]
    else
        port = self::DEFAULT_PORT
    end
    
    port = port.to_i
    
    ##
    
    return self::new(queue, host, port);
end