Class: Rack::Multipart::Parser::Collector::MimePart
- Inherits:
- 
      Struct
      
        - Object
- Struct
- Rack::Multipart::Parser::Collector::MimePart
 
- Defined in:
- lib/rack/multipart/parser.rb
Direct Known Subclasses
Instance Attribute Summary collapse
- 
  
    
      #body  ⇒ Object 
    
    
  
  
  
  
    
    
  
  
  
  
  
  
    Returns the value of attribute body. 
- 
  
    
      #content_type  ⇒ Object 
    
    
  
  
  
  
    
    
  
  
  
  
  
  
    Returns the value of attribute content_type. 
- 
  
    
      #filename  ⇒ Object 
    
    
  
  
  
  
    
    
  
  
  
  
  
  
    Returns the value of attribute filename. 
- 
  
    
      #head  ⇒ Object 
    
    
  
  
  
  
    
    
  
  
  
  
  
  
    Returns the value of attribute head. 
- 
  
    
      #name  ⇒ Object 
    
    
  
  
  
  
    
    
  
  
  
  
  
  
    Returns the value of attribute name. 
Instance Method Summary collapse
Instance Attribute Details
#body ⇒ Object
Returns the value of attribute body
| 143 144 145 | # File 'lib/rack/multipart/parser.rb', line 143 def body @body end | 
#content_type ⇒ Object
Returns the value of attribute content_type
| 143 144 145 | # File 'lib/rack/multipart/parser.rb', line 143 def content_type @content_type end | 
#filename ⇒ Object
Returns the value of attribute filename
| 143 144 145 | # File 'lib/rack/multipart/parser.rb', line 143 def filename @filename end | 
#head ⇒ Object
Returns the value of attribute head
| 143 144 145 | # File 'lib/rack/multipart/parser.rb', line 143 def head @head end | 
#name ⇒ Object
Returns the value of attribute name
| 143 144 145 | # File 'lib/rack/multipart/parser.rb', line 143 def name @name end | 
Instance Method Details
#get_data {|data| ... } ⇒ Object
| 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 | # File 'lib/rack/multipart/parser.rb', line 144 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 |