Extended maintenance of Ruby versions 1.8.7 and 1.9.2 ended on July 31, 2014. Read more

In Files

  • webrick/httputils.rb

WEBrick::HTTPUtils::FormData

Attributes

filename[RW]
name[RW]
next_data[RW]

Public Class Methods

new(*args) click to toggle source
 
               # File webrick/httputils.rb, line 210
def initialize(*args)
  @name = @filename = @next_data = nil
  if args.empty?
    @raw_header = []
    @header = nil
    super("")
  else
    @raw_header = EmptyRawHeader
    @header = EmptyHeader 
    super(args.shift)
    unless args.empty?
      @next_data = self.class.new(*args)
    end
  end
end
            

Public Instance Methods

<<(str) click to toggle source
 
               # File webrick/httputils.rb, line 234
def <<(str)
  if @header
    super
  elsif str == CRLF
    @header = HTTPUtils::parse_header(@raw_header)
    if cd = self['content-disposition']
      if /\s+name="(.*?)"/ =~ cd then @name = $1 end
      if /\s+filename="(.*?)"/ =~ cd then @filename = $1 end
    end
  else
    @raw_header << str
  end
  self
end
            
[](*key) click to toggle source
 
               # File webrick/httputils.rb, line 226
def [](*key)
  begin
    @header[key[0].downcase].join(", ")
  rescue StandardError, NameError
    super
  end
end
            
append_data(data) click to toggle source
 
               # File webrick/httputils.rb, line 249
def append_data(data)
  tmp = self
  while tmp
    unless tmp.next_data 
      tmp.next_data = data
      break
    end
    tmp = tmp.next_data
  end
  self
end
            
each_data() click to toggle source
 
               # File webrick/httputils.rb, line 261
def each_data
  tmp = self
  while tmp
    next_data = tmp.next_data
    yield(tmp)
    tmp = next_data
  end
end
            
list() click to toggle source
 
               # File webrick/httputils.rb, line 270
def list
  ret = []
  each_data{|data|
    ret << data.to_s
  }
  ret
end
            
Also aliased as: to_ary
to_ary() click to toggle source
Alias for: list
to_s() click to toggle source
 
               # File webrick/httputils.rb, line 280
def to_s
  String.new(self)
end
            

Commenting is here to help enhance the documentation. For example, code samples, or clarification of the documentation.

If you have questions about Ruby or the documentation, please post to one of the Ruby mailing lists. You will get better, faster, help that way.

If you wish to post a correction of the docs, please do so, but also file bug report so that it can be corrected for the next release. Thank you.

If you want to help improve the Ruby documentation, please visit Documenting-ruby.org.

blog comments powered by Disqus