lib/sdp/parser.rb in sdp-0.2.4 vs lib/sdp/parser.rb in sdp-0.2.5
- old
+ new
@@ -1,6 +1,7 @@
-require 'sdp'
+require File.expand_path(File.dirname(__FILE__) + '/../sdp')
+require 'rubygems'
require 'parslet'
# Class for parsing SDP description text, ideally when receiving as some sort
# of client that uses SDP for describing the session for that protocol.
#
@@ -8,9 +9,14 @@
# was instead designed to not do so. For example, if the parser parses the
# text from an SDP description, and that text is missing the Timing field (t=),
# the RFC 4566 implies that this description isn't valid (because that field is
# required). Instead ofraising an exception, the parser lets the
# SDP::Description class deal with this.
+#
+# Also, an object of this class parses key/value pairs, where, as a by-product
+# of using +Parslet+, values end up being +Parslet::Slice+ objects. It's worth
+# pointing out that while those are not Strings, they mostly behave like
+# Strings. See the Parslet docs for more info.
class SDP::Parser < Parslet::Parser
# All of the fields
rule(:version) { str('v=') >> field_value.as(:protocol_version) >> eol }
rule(:origin) do