Class: PacketGen::StructFu::Int8
- Defined in:
- lib/packetgen/structfu.rb
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.
141 142 143 144 |
# File 'lib/packetgen/structfu.rb', line 141 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.
147 148 149 |
# File 'lib/packetgen/structfu.rb', line 147 def to_s [(self.v || self.d)].pack("C") end |