Class: Flickr::Uploader::MultiPartForm

Inherits:
Object
  • Object
show all
Defined in:
lib/flickr/uploader.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(boundary = nil) ⇒ MultiPartForm

Returns a new instance of MultiPartForm.



152
153
154
155
# File 'lib/flickr/uploader.rb', line 152

def initialize(boundary=nil)
  @boundary = boundary || "----------------------------Ruby#{rand(1000000000000)}"
  @parts = []
end

Instance Attribute Details

#boundaryObject

Returns the value of attribute boundary.



150
151
152
# File 'lib/flickr/uploader.rb', line 150

def boundary
  @boundary
end

#partsObject

Returns the value of attribute parts.



150
151
152
# File 'lib/flickr/uploader.rb', line 150

def parts
  @parts
end

Instance Method Details

#to_sObject



157
158
159
160
161
# File 'lib/flickr/uploader.rb', line 157

def to_s
  "--#@boundary\r\n" + 
  parts.map{|p| p.to_s}.join("\r\n--#@boundary\r\n")+
  "\r\n--#@boundary--\r\n"
end