Class: PacketGen::StructFu::Int32
- Defined in:
- lib/packetgen/structfu.rb
Overview
Int32 is a four byte value.
Instance Attribute Summary
Attributes inherited from Int
#default, #endian, #value, #width
Instance Method Summary collapse
-
#initialize(v = nil, e = :big) ⇒ Int32
constructor
A new instance of Int32.
-
#to_s ⇒ Object
Returns a four byte value as a packed string.
Methods inherited from Int
Methods inherited from Struct
Constructor Details
#initialize(v = nil, e = :big) ⇒ Int32
Returns a new instance of Int32.
182 183 184 185 |
# File 'lib/packetgen/structfu.rb', line 182 def initialize(v=nil, e=:big) super(v,e,w=4) @packstr = (self.e == :big) ? "N" : "V" end |
Instance Method Details
#to_s ⇒ Object
Returns a four byte value as a packed string.
188 189 190 191 |
# File 'lib/packetgen/structfu.rb', line 188 def to_s @packstr = (self.e == :big) ? "N" : "V" [(self.v || self.d)].pack(@packstr) end |