Class: StructFu::Int8
Overview
Int8 is a one byte value.
Instance Attribute Summary
Attributes inherited from Int
#default, #endian, #value, #width
Instance Method Summary collapse
-
#initialize(v = nil) ⇒ Int8
constructor
A new instance of Int8.
-
#to_s ⇒ Object
Returns a one byte value as a packed string.
Methods inherited from Int
Methods inherited from Struct
Constructor Details
#initialize(v = nil) ⇒ Int8
Returns a new instance of Int8.
99 100 101 102 |
# File 'lib/packetfu/structfu.rb', line 99 def initialize(v=nil) super(v,nil,w=1) @packstr = "C" end |
Instance Method Details
#to_s ⇒ Object
Returns a one byte value as a packed string.
105 106 107 |
# File 'lib/packetfu/structfu.rb', line 105 def to_s [(self.v || self.d)].pack("C") end |