Class SOAP::MIMEMessage::Part
In: lib/soap/mimemessage.rb
Parent: Object

Methods

contentid   new   parse   parse   to_s  

External Aliases

body -> content

Attributes

body  [RW] 
headers  [RW] 

Public Class methods

[Source]

     # File lib/soap/mimemessage.rb, line 111
111:     def initialize
112:       @headers = Headers.new
113:       @headers.add("Content-Transfer-Encoding", "8bit")
114:       @body = nil
115:       @contentid = nil
116:     end

[Source]

     # File lib/soap/mimemessage.rb, line 118
118:     def self.parse(str)
119:       new.parse(str)
120:     end

Public Instance methods

[Source]

     # File lib/soap/mimemessage.rb, line 133
133:     def contentid
134:       if @contentid == nil and @headers.key?('content-id')
135:         @contentid = @headers['content-id'].str
136:         @contentid = $1 if @contentid =~ /^<(.+)>$/
137:       end
138:       @contentid
139:     end

[Source]

     # File lib/soap/mimemessage.rb, line 122
122:     def parse(str)
123:       headers, body = str.split(/\r\n\r\n/s)
124:       if headers != nil and body != nil
125:         @headers = Headers.parse(headers)
126:         @body = body.sub(/\r\n\z/, '')
127:       else
128:         raise RuntimeError.new("unexpected part: #{str.inspect}")
129:       end
130:       self
131:     end

[Source]

     # File lib/soap/mimemessage.rb, line 143
143:     def to_s
144:       @headers.to_s + "\r\n\r\n" + @body
145:     end

[Validate]