Class SOAP::Attachment
In: lib/soap/attachment.rb
Parent: Object

Methods

Attributes

contenttype  [RW] 
io  [R] 

Public Class methods

[Source]

    # File lib/soap/attachment.rb, line 76
76:   def self.contentid(obj)
77:     # this needs to be fixed
78:     [obj.__id__.to_s, Process.pid.to_s].join('.')
79:   end

[Source]

    # File lib/soap/attachment.rb, line 81
81:   def self.mime_contentid(obj)
82:     '<' + contentid(obj) + '>'
83:   end

[Source]

    # File lib/soap/attachment.rb, line 36
36:   def initialize(string_or_readable = nil)
37:     @string_or_readable = string_or_readable
38:     @contenttype = "application/octet-stream"
39:     @contentid = nil
40:   end

Public Instance methods

[Source]

    # File lib/soap/attachment.rb, line 54
54:   def content
55:     if @content == nil and @string_or_readable != nil
56:       @content = @string_or_readable.respond_to?(:read) ?
57:         @string_or_readable.read : @string_or_readable
58:     end
59:     @content
60:   end

[Source]

    # File lib/soap/attachment.rb, line 42
42:   def contentid
43:     @contentid ||= Attachment.contentid(self)
44:   end

[Source]

    # File lib/soap/attachment.rb, line 46
46:   def contentid=(contentid)
47:     @contentid = contentid
48:   end

[Source]

    # File lib/soap/attachment.rb, line 50
50:   def mime_contentid
51:     '<' + contentid + '>'
52:   end

[Source]

    # File lib/soap/attachment.rb, line 70
70:   def save(filename)
71:     File.open(filename, "wb") do |f|
72:       write(f)
73:     end
74:   end

[Source]

    # File lib/soap/attachment.rb, line 62
62:   def to_s
63:     content
64:   end

[Source]

    # File lib/soap/attachment.rb, line 66
66:   def write(out)
67:     out.write(content)
68:   end

[Validate]