Module: RTSP::Helpers

Includes:
Global
Included in:
Message
Defined in:
lib/rtsp/helpers.rb

Constant Summary

Constants included from Global

Global::DEFAULT_RTSP_PORT, Global::DEFAULT_VERSION

Instance Attribute Summary

Attributes included from Global

#log, #log_level, #logger, #raise_errors

Instance Method Summary collapse

Methods included from Global

#log?, #raise_errors?, #reset_config!, #rtsp_version

Instance Method Details

#build_resource_uri_from(url) ⇒ URI

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

Parameters:

  • url (String)

    The URL to turn in to a URI.

Returns:

  • (URI)

14
15
16
17
18
19
20
21
22
23
24
25
26
# 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