| Class | SOAP::Attachment |
| In: |
lib/soap/attachment.rb
|
| Parent: | Object |
| contenttype | [RW] | |
| io | [R] |
# 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
# File lib/soap/attachment.rb, line 81
81: def self.mime_contentid(obj)
82: '<' + contentid(obj) + '>'
83: end
# 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
# 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
# File lib/soap/attachment.rb, line 42
42: def contentid
43: @contentid ||= Attachment.contentid(self)
44: end
# File lib/soap/attachment.rb, line 46
46: def contentid=(contentid)
47: @contentid = contentid
48: end
# 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