Method: SOAP::MIMEMessage::Headers#parse
- Defined in:
- lib/soap/mimemessage.rb
#parse(str) ⇒ Object
51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 |
# File 'lib/soap/mimemessage.rb', line 51 def parse(str) header_cache = nil str = str.lines if str.respond_to?(:lines) # RubyJedi: compatible with Ruby 1.8.6 and above str.each do |line| case line when /^\A[^\: \t]+:\s*.+$/ parse_line(header_cache) if header_cache header_cache = line.sub(/\r?\n\z/, '') when /^\A\s+(.*)$/ # a continuous line at the beginning line crashes here. header_cache << line else raise RuntimeError.new("unexpected header: #{line.inspect}") end end parse_line(header_cache) if header_cache self end |