class Rack::Multipart::Parser::Collector
Public Class Methods
Source
# File lib/rack/multipart/parser.rb, line 143 def initialize(tempfile) @tempfile = tempfile @mime_parts = [] @open_files = 0 end
Public Instance Methods
Source
# File lib/rack/multipart/parser.rb, line 149 def each @mime_parts.each { |part| yield part } end
Source
# File lib/rack/multipart/parser.rb, line 169 def on_mime_body(mime_index, content) @mime_parts[mime_index].body << content end
Source
# File lib/rack/multipart/parser.rb, line 173 def on_mime_finish(mime_index) end
Source
# File lib/rack/multipart/parser.rb, line 153 def on_mime_head(mime_index, head, filename, content_type, name) if filename body = @tempfile.call(filename, content_type) body.binmode if body.respond_to?(:binmode) klass = TempfilePart @open_files += 1 else body = String.new klass = BufferPart end @mime_parts[mime_index] = klass.new(body, head, filename, content_type, name) check_part_limits end