Module: FluQ::URL

Defined in:
lib/fluq/url.rb

Class Method Summary collapse

Class Method Details

.parse(url, schemes = ["tcp", "unix"]) ⇒ Object

Parameters:

  • url (String)

    the URL



6
7
8
9
10
11
12
13
14
# File 'lib/fluq/url.rb', line 6

def self.parse(url, schemes = ["tcp", "unix"])
  url = URI.parse(url)
  case url.scheme
  when *schemes
    url
  else
    raise URI::InvalidURIError, "Invalid URI scheme, only #{schemes.join(', ')} are allowed"
  end
end