lib/onstomp/failover/uri.rb in onstomp-1.0.1 vs lib/onstomp/failover/uri.rb in onstomp-1.0.2
- old
+ new
@@ -10,13 +10,11 @@
# any query parameters for the failover URI.
FAILOVER_REG = /^failover:(?:\/\/)?\(?([^\)]+)\)?(?:\?(.*))?/
attr_reader :failover_uris
def initialize uris, query
- @failover_uris = uris.map do |u|
- u.is_a?(::URI) ? u : ::URI.parse(u.strip)
- end
+ @failover_uris = uris
super 'failover', nil, nil, nil, nil, '', "(#{uris.join(',')})", query, nil
end
# Converts a failover URI into a string. Ruby's Generic URIs don't seem
# to allow mixing opaques and queries.
@@ -40,15 +38,13 @@
# @return [FAILOVER]
# @overload parse(uri_arr)
# @param [Array<String or URI>] uri_arr
# @return [FAILOVER]
def parse uri_str
- if uri_str.is_a? Array
- self.new uri_str, nil
- elsif uri_str =~ FAILOVER_REG
+ if uri_str =~ FAILOVER_REG
self.new $1.split(','), $2
else
- raise OnStomp::Failover::InvalidFailoverURIError, uri_str
+ raise OnStomp::Failover::InvalidFailoverURIError, uri_str.inspect
end
end
end
end
end