Parent

Rserve::Packet

Constants

ERROR_DESCRIPTIONS

Attributes

cont[R]
cmd[R]

Public Class Methods

new(cmd, cont) click to toggle source
# File lib/rserve/packet.rb, line 11
def initialize(cmd, cont)
  raise "cont [#{cont.class} - #{cont.to_s}] should respond to :length" if !cont.nil? and !cont.respond_to? :length
  @cmd=cmd
  @cont=cont
end

Public Instance Methods

cont_len() click to toggle source
# File lib/rserve/packet.rb, line 16
def cont_len
  @cont.nil? ? 0 : @cont.length
end
error?() click to toggle source
# File lib/rserve/packet.rb, line 22
def error?
  @cmd&15==2
end
get_error_description(stat) click to toggle source
# File lib/rserve/packet.rb, line 28
def get_error_description(stat)
  ERROR_DESCRIPTIONS[stat]
end
ok?() click to toggle source
# File lib/rserve/packet.rb, line 19
def ok?
  @cmd&15==1
end
stat() click to toggle source
# File lib/rserve/packet.rb, line 25
def stat
  (@cmd>>24)&127
end
to_s() click to toggle source
# File lib/rserve/packet.rb, line 31
def to_s
  if error?
    status="error:'#{get_error_description(stat)}'(#{stat})"
  else
    status="ok"
  end
  "Packet[cmd=#{@cmd},len="+((cont.nil?)?"<nil>":(""+cont.length.to_s))+", con='"+(cont.nil?  ? "<nil>" : cont.pack("C*"))+"', status=#{status}]"
end

[Validate]

Generated with the Darkfish Rdoc Generator 2.