Class: FCGI::RecordBuffer

### Home Classes Methods

### In Files

- lib/fcgi.rb

### Parent

Object

### Methods

- ::new
- #data
- #env
- #new_request
- #push
- #ready?
- #stdin

### Files

- LICENSE
- README.rdoc

### Class/Module Index

Quicksearch

- FCGI
- FCGI::AbortRequestRecord
- FCGI::BeginRequestRecord
- FCGI::DataRecord
- FCGI::EndRequestRecord
- FCGI::FastCGISocket
- FCGI::GenericDataRecord
- FCGI::GetValuesRecord
- FCGI::ParamsRecord
- FCGI::Record
- FCGI::RecordBuffer
- FCGI::Request
- FCGI::Server
- FCGI::StdinDataRecord
- FCGI::StdoutDataRecord
- FCGI::UnknownTypeRecord
- FCGI::ValuesRecord

No matching classes.

# FCGI::RecordBuffer

### Public Class Methods

new(rec) click to toggle source

    # File lib/fcgi.rb, line 221
    def initialize(rec)
      @begin_request = rec
      @envs = []
      @stdins = []
      @datas = []
    end

### Public Instance Methods

data() click to toggle source

    # File lib/fcgi.rb, line 276
    def data
      StringIO.new(@datas.inject('') {|buf, rec| buf << rec.flagment })
    end

env() click to toggle source

    # File lib/fcgi.rb, line 266
    def env
      h = {}
      @envs.each {|rec| h.update rec.values }
      h
    end

new_request() click to toggle source

    # File lib/fcgi.rb, line 262
    def new_request
      Request.new(@begin_request.request_id, env(), stdin(), nil, nil, data())
    end

push(rec) click to toggle source

    # File lib/fcgi.rb, line 228
    def push(rec)
      case rec
      when ParamsRecord
        @envs.push rec
      when StdinDataRecord
        @stdins.push rec
      when DataRecord
        @datas.push rec
      else
        raise "got unknown record: #{rec.class}"
      end
    end

ready?() click to toggle source

    # File lib/fcgi.rb, line 241
    def ready?
      case @begin_request.role
      when FCGI_RESPONDER
        completed?(@envs) and
        completed?(@stdins)
      when FCGI_AUTHORIZER
        completed?(@envs)
      when FCGI_FILTER
        completed?(@envs) and
        completed?(@stdins) and
        completed?(@datas)
      else
        raise "unknown role: #{@begin_request.role}"
      end
    end

stdin() click to toggle source

    # File lib/fcgi.rb, line 272
    def stdin
      StringIO.new(@stdins.inject('') {|buf, rec| buf << rec.flagment })
    end

[Validate]

Generated with the Darkfish Rdoc Generator 2.