Class: RubyForge::Client

Class | RubyForge::Client
In: | lib/echoe/client.rb lib/echoe/client.rb
Parent: | Object

Fixes for Rubyforge 1.0.0 client.rb

### Methods

boundary_data_for boundary_data_for

### Public Instance methods

boundary_data_for(boundary, parameters)

[Source]

        # File lib/echoe/client.rb, line 4
     4:   def boundary_data_for(boundary, parameters)
     5:     parameters.sort_by {|k,v| k.to_s }.map { |k,v|
     6:       parameter = "--#{boundary}\r\nContent-Disposition: form-data; name=\"" +
     7:           WEBrick::HTTPUtils.escape_form(k.to_s) + "\""
     8:
     9:       if v.respond_to?(:path)
    10:         parameter += "; filename=\"#{File.basename(v.path)}\"\r\n"
    11:         parameter += "Content-Transfer-Encoding: binary\r\n"
    12:         parameter += "Content-Type: text/plain"
    13:       end
    14:       parameter += "\r\n\r\n"
    15:
    16:       if v.respond_to?(:path)
    17:         parameter += v.read
    18:       elsif
    19:         parameter += v.to_s
    20:       end
    21:
    22:       parameter
    23:     }.join("\r\n") + "\r\n--#{boundary}--\r\n"
    24:   end

boundary_data_for(boundary, parameters)

[Source]

        # File lib/echoe/client.rb, line 4
     4:   def boundary_data_for(boundary, parameters)
     5:     parameters.sort_by {|k,v| k.to_s }.map { |k,v|
     6:       parameter = "--#{boundary}\r\nContent-Disposition: form-data; name=\"" +
     7:           WEBrick::HTTPUtils.escape_form(k.to_s) + "\""
     8:
     9:       if v.respond_to?(:path)
    10:         parameter += "; filename=\"#{File.basename(v.path)}\"\r\n"
    11:         parameter += "Content-Transfer-Encoding: binary\r\n"
    12:         parameter += "Content-Type: text/plain"
    13:       end
    14:       parameter += "\r\n\r\n"
    15:
    16:       if v.respond_to?(:path)
    17:         parameter += v.read
    18:       elsif
    19:         parameter += v.to_s
    20:       end
    21:
    22:       parameter
    23:     }.join("\r\n") + "\r\n--#{boundary}--\r\n"
    24:   end

[Validate]