Class: Baykit::BayServer::Docker::Fcgi::Command::InOutCommandBase
- Inherits:
-
FcgCommand
- Object
- Protocol::Command
- FcgCommand
- Baykit::BayServer::Docker::Fcgi::Command::InOutCommandBase
- Defined in:
- lib/baykit/bayserver/docker/fcgi/command/in_out_command_base.rb
Constant Summary collapse
- MAX_DATA_LEN =
FcgPacket::MAXLEN - FcgPacket::PREAMBLE_SIZE
Instance Attribute Summary collapse
-
#data ⇒ Object
readonly
Returns the value of attribute data.
-
#length ⇒ Object
readonly
Returns the value of attribute length.
-
#start ⇒ Object
readonly
This class refers external byte array, so this IS NOT mutable.
Attributes inherited from FcgCommand
Instance Method Summary collapse
-
#initialize(type, req_id, data = nil, start = 0, len = 0) ⇒ InOutCommandBase
constructor
A new instance of InOutCommandBase.
- #pack(pkt) ⇒ Object
- #unpack(pkt) ⇒ Object
Methods inherited from FcgCommand
Constructor Details
#initialize(type, req_id, data = nil, start = 0, len = 0) ⇒ InOutCommandBase
Returns a new instance of InOutCommandBase.
28 29 30 31 32 33 |
# File 'lib/baykit/bayserver/docker/fcgi/command/in_out_command_base.rb', line 28 def initialize(type, req_id, data=nil, start=0, len=0) super(type, req_id) @data = data @start = start @length = len end |
Instance Attribute Details
#data ⇒ Object (readonly)
Returns the value of attribute data.
26 27 28 |
# File 'lib/baykit/bayserver/docker/fcgi/command/in_out_command_base.rb', line 26 def data @data end |
#length ⇒ Object (readonly)
Returns the value of attribute length.
25 26 27 |
# File 'lib/baykit/bayserver/docker/fcgi/command/in_out_command_base.rb', line 25 def length @length end |
#start ⇒ Object (readonly)
This class refers external byte array, so this IS NOT mutable
24 25 26 |
# File 'lib/baykit/bayserver/docker/fcgi/command/in_out_command_base.rb', line 24 def start @start end |
Instance Method Details
#pack(pkt) ⇒ Object
42 43 44 45 46 47 48 49 50 |
# File 'lib/baykit/bayserver/docker/fcgi/command/in_out_command_base.rb', line 42 def pack(pkt) if @data != nil && @length > 0 acc = pkt.new_data_accessor() acc.put_bytes(@data, @start, @length) end # must be called from last line super end |
#unpack(pkt) ⇒ Object
35 36 37 38 39 40 |
# File 'lib/baykit/bayserver/docker/fcgi/command/in_out_command_base.rb', line 35 def unpack(pkt) super @start = pkt.header_len @length = pkt.data_len @data = pkt.buf end |