Class: WEBrick::HTTPUtils::FormData

Class | WEBrick::HTTPUtils::FormData
In: | webrick/httputils.rb
Parent: | String

### Methods

<< [] append_data each_data list new to_ary to_s

### Constants

EmptyRawHeader | = | [].freeze
EmptyHeader | = | {}.freeze

### Attributes

filename | [RW] |
name | [RW] |

### Public Class methods

new(*args)

[Source]

    # File webrick/httputils.rb, line 218
          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)

[Source]

    # File webrick/httputils.rb, line 242
          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)

[Source]

    # File webrick/httputils.rb, line 234
          def [](*key)
            begin
              @header[key[0].downcase].join(", ")
            rescue StandardError, NameError
              super
            end
          end

append_data(data)

[Source]

    # File webrick/httputils.rb, line 257
          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() {|tmp| ...}

[Source]

    # File webrick/httputils.rb, line 269
          def each_data
            tmp = self
            while tmp
              next_data = tmp.next_data
              yield(tmp)
              tmp = next_data
            end
          end

list()

[Source]

    # File webrick/httputils.rb, line 278
          def list
            ret = []
            each_data{|data|
              ret << data.to_s
            }
            ret
          end

to_ary()

Alias for list

to_s()

[Source]

    # File webrick/httputils.rb, line 288
          def to_s
            String.new(self)
          end

[Validate]