123456789_123456789_123456789_123456789_123456789_

Class: Rack::Multipart::Parser::Collector::MimePart

Relationships & Source Files
Extension / Inclusion / Inheritance Descendants
Subclasses:
Super Chains via Extension / Inclusion / Inheritance
Class Chain:
self, Struct
Instance Chain:
self, Struct
Inherits: Struct
  • Object
Defined in: lib/rack/multipart/parser.rb

Instance Attribute Summary

Instance Method Summary

Instance Attribute Details

#body (rw)

[ GitHub ]

  
# File 'lib/rack/multipart/parser.rb', line 108

class MimePart < Struct.new(:body, :head, :filename, :content_type, :name)

#content_type (rw)

[ GitHub ]

  
# File 'lib/rack/multipart/parser.rb', line 108

class MimePart < Struct.new(:body, :head, :filename, :content_type, :name)

#filename (rw)

[ GitHub ]

  
# File 'lib/rack/multipart/parser.rb', line 108

class MimePart < Struct.new(:body, :head, :filename, :content_type, :name)

#head (rw)

[ GitHub ]

  
# File 'lib/rack/multipart/parser.rb', line 108

class MimePart < Struct.new(:body, :head, :filename, :content_type, :name)

#name (rw)

[ GitHub ]

  
# File 'lib/rack/multipart/parser.rb', line 108

class MimePart < Struct.new(:body, :head, :filename, :content_type, :name)

Instance Method Details

#get_data {|data| ... }

Yields:

  • (data)
[ GitHub ]

  
# File 'lib/rack/multipart/parser.rb', line 109

def get_data
  data = body
  if filename == ""
    # filename is blank which means no file has been selected
    return
  elsif filename
    body.rewind if body.respond_to?(:rewind)

    # Take the basename of the upload's original filename.
    # This handles the full Windows paths given by Internet Explorer
    # (and perhaps other broken user agents) without affecting
    # those which give the lone filename.
    fn = filename.split(/[\/\\]/).last

    data = { filename: fn, type: content_type,
            name: name, tempfile: body, head: head }
  end

  yield data
end