class StructFu::Int16

Int16 is a two byte value.

Public Class Methods

new(v=nil, e=:big) click to toggle source
Calls superclass method StructFu::Int::new
# File lib/packetfu/structfu.rb, line 112
def initialize(v=nil, e=:big)
  super(v,e,w=2)
  @packstr = (self.e == :big) ? "n" : "v"
end

Public Instance Methods

to_s() click to toggle source

Returns a two byte value as a packed string.

# File lib/packetfu/structfu.rb, line 118
def to_s
  @packstr = (self.e == :big) ? "n" : "v"
  [(self.v || self.d)].pack(@packstr)
 end