module RTSP::Helpers

Public Instance Methods

build_resource_uri_from(url) click to toggle source

Takes the URL given and turns it into a URI. This allows for enforcing values for each part of the URI.

@param [String] url The URL to turn in to a URI. @return [URI]

# File lib/rtsp/helpers.rb, line 14
def build_resource_uri_from url
  if url.is_a? String
    url = "rtsp://#{url}" unless url =~ /^rtsp/

    resource_uri = URI.parse url
    resource_uri.port ||= DEFAULT_RTSP_PORT

    resource_uri

  else
    raise RTSP::Error, "url must be a String."
  end
end