lib/rtsp/response.rb in rtsp-0.2.2 vs lib/rtsp/response.rb in rtsp-0.3.0

- old
+ new

@@ -14,11 +14,12 @@ # @param [String] raw_response The raw response string returned from the # server/client. def initialize(raw_response) if raw_response.nil? || raw_response.empty? - raise RTSP::Error, "#{self.class} received nil string--this shouldn't happen." + raise RTSP::Error, + "#{self.class} received nil string--this shouldn't happen." end @raw_response = raw_response head, body = split_head_and_body_from @raw_response @@ -75,24 +76,24 @@ if @rtsp_version.nil? raise RTSP::Error, "Status line corrupted: #{line}" end end - # Reads through each header line of the RTSP response, extracts the response - # code, response message, response version, and creates a snake-case - # accessor with that value set. + # Reads through each header line of the RTSP response, extracts the + # response code, response message, response version, and creates a + # snake-case accessor with that value set. # # @param [String] head The section of headers from the response text. def parse_head head lines = head.split "\r\n" lines.each_with_index do |line, i| if i == 0 extract_status_line(line) next end - + if line.include? ": " header_and_value = line.strip.split(":", 2) header_name = header_and_value.first.downcase.gsub(/-/, "_") create_reader(header_name, header_and_value[1].strip) end @@ -117,11 +118,11 @@ end end private - # Creates an attr_reader with the name given and sets it to the value that's - # given. + # Creates an attr_reader with the name given and sets it to the value + # that's given. # # @param [String] name # @param [String] value def create_reader(name, value) unless value.empty?