Class: Hermeneutics::Cgi::Data::Multiparted

Inherits:
Plain
  • Object
show all
Defined in:
lib/hermeneutics/cgi.rb

Instance Attribute Summary

Attributes inherited from Plain

#data

Instance Method Summary collapse

Constructor Details

#initialize(data, params) ⇒ Multiparted

Returns a new instance of Multiparted.



194
195
196
197
# File 'lib/hermeneutics/cgi.rb', line 194

def initialize data, params
  super data
  @params = params
end

Instance Method Details

#parseObject



198
199
200
201
202
203
204
205
206
# File 'lib/hermeneutics/cgi.rb', line 198

def parse
  mp = Multipart.parse @data, **@params
  mp.each { |part|
    cd = part.headers.content_disposition
    if cd.caption == "form-data" then
      yield cd.name, part.body_decoded, **cd.hash
    end
  }
end