Class: FCGI::ValuesRecord
Direct Known Subclasses
Constant Summary
Constants inherited from Record
Record::HEADER_FORMAT, Record::HEADER_LENGTH, Record::RECORD_CLASS
Instance Attribute Summary collapse
-
#values ⇒ Object
readonly
Returns the value of attribute values.
Attributes inherited from Record
Class Method Summary collapse
- .parse(id, body) ⇒ Object
- .parse_values(buf) ⇒ Object
- .read_length(buf) ⇒ Object
- .read_pair(buf) ⇒ Object
Instance Method Summary collapse
-
#initialize(type, id, values) ⇒ ValuesRecord
constructor
A new instance of ValuesRecord.
Methods inherited from Record
class_for, #management_record?, parse_header, #serialize, #version
Constructor Details
#initialize(type, id, values) ⇒ ValuesRecord
Returns a new instance of ValuesRecord.
461 462 463 464 |
# File 'lib/cgialt/fcgi/core.rb', line 461 def initialize(type, id, values) super type, id @values = values end |
Instance Attribute Details
#values ⇒ Object (readonly)
Returns the value of attribute values.
466 467 468 |
# File 'lib/cgialt/fcgi/core.rb', line 466 def values @values end |
Class Method Details
.parse(id, body) ⇒ Object
435 436 437 |
# File 'lib/cgialt/fcgi/core.rb', line 435 def self::parse(id, body) new(id, parse_values(body)) end |
.parse_values(buf) ⇒ Object
439 440 441 442 443 444 445 446 |
# File 'lib/cgialt/fcgi/core.rb', line 439 def self::parse_values(buf) result = {} until buf.empty? name, value = *read_pair(buf) result[name] = value end result end |
.read_length(buf) ⇒ Object
454 455 456 457 458 459 |
# File 'lib/cgialt/fcgi/core.rb', line 454 def self::read_length(buf) if buf[0] >> 7 == 0 then buf.slice!(0,1)[0] else buf.slice!(0,4).unpack('N')[0] & ((1<<31) - 1) end end |
.read_pair(buf) ⇒ Object
448 449 450 451 452 |
# File 'lib/cgialt/fcgi/core.rb', line 448 def self::read_pair(buf) nlen = read_length(buf) vlen = read_length(buf) return buf.slice!(0, nlen), buf.slice!(0, vlen) end |