Module: Fog::Radosgw::MultipartUtils

Included in:
Provisioning::Real
Defined in:
lib/fog/radosgw/multipart_utils.rb,
lib/fog/radosgw/multipart_utils/headers.rb

Defined Under Namespace

Classes: Headers

Instance Method Summary collapse

Instance Method Details

#extract_boundary(header_string) ⇒ Object



13
14
15
# File 'lib/fog/radosgw/multipart_utils.rb', line 13

def extract_boundary(header_string)
  $1 if header_string =~ /boundary=([A-Za-z0-9\'()+_,-.\/:=?]+)/
end

#parse(data, boundary) ⇒ Object



6
7
8
9
10
11
# File 'lib/fog/radosgw/multipart_utils.rb', line 6

def parse(data, boundary)
  contents = data.match(end_boundary_regex(boundary)).pre_match rescue ""
  contents.split(inner_boundary_regex(boundary)).reject(&:empty?).map do |part|
    parse_multipart_section(part)
  end.compact
end