Class: Gem::Commands::SboxCommand::Multipart::FileParam

Inherits:
Object
  • Object
show all
Defined in:
lib/rubygems/commands/sbox_command.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(k, filename, content) ⇒ FileParam

Returns a new instance of FileParam.



134
135
136
137
138
# File 'lib/rubygems/commands/sbox_command.rb', line 134

def initialize( k, filename, content )
  @k = k
  @filename = filename
  @content = content
end

Instance Attribute Details

#contentObject

Returns the value of attribute content.



133
134
135
# File 'lib/rubygems/commands/sbox_command.rb', line 133

def content
  @content
end

#filenameObject

Returns the value of attribute filename.



133
134
135
# File 'lib/rubygems/commands/sbox_command.rb', line 133

def filename
  @filename
end

#kObject

Returns the value of attribute k.



133
134
135
# File 'lib/rubygems/commands/sbox_command.rb', line 133

def k
  @k
end

Instance Method Details

#to_multipartObject



140
141
142
# File 'lib/rubygems/commands/sbox_command.rb', line 140

def to_multipart
  return "Content-Disposition: form-data; name=\"#{k}\"; filename=\"#{filename}\"\r\n" + "Content-Transfer-Encoding: binary\r\n" + "Content-Type: application/octet-stream\r\n\r\n" + content + "\r\n"
end