Class: SDP

Inherits:
Object
  • Object
show all
Defined in:
lib/sdp.rb,
lib/sdp/version.rb,
lib/sdp/description.rb

Overview

The only use for this class is the #parse method, which is in this base class solely for convenience. Other than this method, this base class doesn’t really do anything.

Defined Under Namespace

Classes: Description, ParseError, Parser, RuntimeError

Constant Summary collapse

VERSION =
"0.2.9"
PROTOCOL_VERSION =
0

Class Method Summary collapse

Class Method Details

.parse(sdp_text) ⇒ SDP::Description

Creates a parser and parses the given text in to an SDP::Description object.

Parameters:

  • sdp_text (String)

    The text from an SDP description.

Returns:

  • (SDP::Description)

    The object that represents the description that was parsed.

Raises:

  • (SDP::ParseError)

    If parsing fails, raise an SDP::ParseError instead of a Parslet exception that might confuse SDP users.



20
21
22
23
24
25
26
27
28
# File 'lib/sdp.rb', line 20

def self.parse sdp_text
  begin
    sdp_hash = SDP::Parser.new.parse sdp_text
  rescue Parslet::UnconsumedInput => ex
    raise SDP::ParseError, ex
  end

  SDP::Description.new(sdp_hash.keys_to_s)
end