Class: StructFu::Int8

Inherits:
Int show all
Defined in:
lib/packetfu/structfu.rb

Overview

Int8 is a one byte value.

Instance Attribute Summary

Attributes inherited from Int

#default, #endian, #value, #width

Instance Method Summary collapse

Methods inherited from Int

#read, #to_f, #to_i

Methods inherited from Struct

#force_binary

Constructor Details

#initialize(v = nil) ⇒ 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_sObject

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