class SOAP::Attachment
Attributes
contenttype[RW]
io[R]
Public Class Methods
contentid(obj)
click to toggle source
# File lib/soap/attachment.rb, line 78 def self.contentid(obj) # this needs to be fixed [obj.__id__.to_s, Process.pid.to_s].join('.') end
mime_contentid(obj)
click to toggle source
# File lib/soap/attachment.rb, line 83 def self.mime_contentid(obj) '<' + contentid(obj) + '>' end
new(string_or_readable = nil)
click to toggle source
# File lib/soap/attachment.rb, line 37 def initialize(string_or_readable = nil) @string_or_readable = string_or_readable @contenttype = "application/octet-stream" @contentid = nil @content = nil end
Public Instance Methods
content()
click to toggle source
# File lib/soap/attachment.rb, line 56 def content if @content == nil and @string_or_readable != nil @content = @string_or_readable.respond_to?(:read) ? @string_or_readable.read : @string_or_readable end @content end
contentid()
click to toggle source
# File lib/soap/attachment.rb, line 44 def contentid @contentid ||= Attachment.contentid(self) end
contentid=(contentid)
click to toggle source
# File lib/soap/attachment.rb, line 48 def contentid=(contentid) @contentid = contentid end
mime_contentid()
click to toggle source
# File lib/soap/attachment.rb, line 52 def mime_contentid '<' + contentid + '>' end
save(filename)
click to toggle source
# File lib/soap/attachment.rb, line 72 def save(filename) File.open(filename, "wb") do |f| write(f) end end
to_s()
click to toggle source
# File lib/soap/attachment.rb, line 64 def to_s content end
write(out)
click to toggle source
# File lib/soap/attachment.rb, line 68 def write(out) out.write(content) end