Class: SOAP::MIMEMessage::Part
Instance Attribute Summary collapse
-
#body ⇒ Object
(also: #content)
Returns the value of attribute body.
-
#headers ⇒ Object
Returns the value of attribute headers.
Class Method Summary collapse
Instance Method Summary collapse
- #contentid ⇒ Object
-
#initialize ⇒ Part
constructor
A new instance of Part.
- #parse(str) ⇒ Object
- #to_s ⇒ Object
Constructor Details
Instance Attribute Details
#body ⇒ Object Also known as: content
Returns the value of attribute body.
111 112 113 |
# File 'lib/soap/mimemessage.rb', line 111 def body @body end |
#headers ⇒ Object
Returns the value of attribute headers.
111 112 113 |
# File 'lib/soap/mimemessage.rb', line 111 def headers @headers end |
Class Method Details
.parse(str) ⇒ Object
120 121 122 |
# File 'lib/soap/mimemessage.rb', line 120 def self.parse(str) new.parse(str) end |
Instance Method Details
#contentid ⇒ Object
135 136 137 138 139 140 141 |
# File 'lib/soap/mimemessage.rb', line 135 def contentid if @contentid == nil and @headers.key?('content-id') @contentid = @headers['content-id'].str @contentid = $1 if @contentid =~ /^<(.+)>$/ end @contentid end |
#parse(str) ⇒ Object
124 125 126 127 128 129 130 131 132 133 |
# File 'lib/soap/mimemessage.rb', line 124 def parse(str) headers, body = str.split(/\r\n\r\n/, 2) if headers != nil and body != nil @headers = Headers.parse(headers) @body = body.sub(/\r\n\z/, '') else raise RuntimeError.new("unexpected part: #{str.inspect}") end self end |
#to_s ⇒ Object
145 146 147 |
# File 'lib/soap/mimemessage.rb', line 145 def to_s @headers.to_s + "\r\n\r\n" + @body end |