Class SOAP::MIMEMessage::Part
In: 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 soap/mimemessage.rb, line 111
    def initialize
      @headers = Headers.new
      @headers.add("Content-Transfer-Encoding", "8bit")
      @body = nil
      @contentid = nil
    end

[Source]

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

Public Instance methods

[Source]

# File 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

[Source]

# File soap/mimemessage.rb, line 122
    def parse(str)
      headers, body = str.split(/\r\n\r\n/s)
      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

[Source]

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

[Validate]