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.
109 110 111 |
# File 'lib/soap/mimemessage.rb', line 109 def body @body end |
#headers ⇒ Object
Returns the value of attribute headers.
109 110 111 |
# File 'lib/soap/mimemessage.rb', line 109 def headers @headers end |
Class Method Details
.parse(str) ⇒ Object
118 119 120 |
# File 'lib/soap/mimemessage.rb', line 118 def self.parse(str) new.parse(str) end |
Instance Method Details
#contentid ⇒ Object
133 134 135 136 137 138 139 |
# File 'lib/soap/mimemessage.rb', line 133 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
122 123 124 125 126 127 128 129 130 131 |
# File 'lib/soap/mimemessage.rb', line 122 def parse(str) headers, body = str.split(/\r\n\r\n/s, 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
143 144 145 |
# File 'lib/soap/mimemessage.rb', line 143 def to_s @headers.to_s + "\r\n\r\n" + @body end |