Sha256: abe17a52f6489b1184028deb282bbad625f985ecff5dd5a8019c6c9a3889a07e

Contents?: true

Size: 1.12 KB

Versions: 4

Compression:

Stored size: 1.12 KB

Contents

require File.expand_path(File.dirname(__FILE__) + '/sdp/version')
require File.expand_path(File.dirname(__FILE__) + '/sdp/description')
require File.expand_path(File.dirname(__FILE__) + '/sdp/parser')
require File.expand_path(File.dirname(__FILE__) + '/sdp/parse_error')
require File.expand_path(File.dirname(__FILE__) + '/ext/hash_patch')

# 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.
class SDP

  # Creates a parser and parses the given text in to an +SDP::Description+
  # object.
  #
  # @param [String] sdp_text The text from an SDP description.
  # @return [SDP::Description] The object that represents the description
  #   that was parsed.
  # @raise [SDP::ParseError] If parsing fails, raise an SDP::ParseError instead
  #   of a Parslet exception that might confuse SDP users.
  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
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
sdp-0.2.9 lib/sdp.rb
sdp-0.2.8 lib/sdp.rb
sdp-0.2.7 lib/sdp.rb
sdp-0.2.6 lib/sdp.rb