Class: Lib::BOOTP::Packet::HardwareAddressLength

Inherits:
Object
  • Object
show all
Extended by:
Forwardable
Includes:
Comparable
Defined in:
lib/lib/bootp/packet/hardware_address_length.rb

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(hlen = 6) ⇒ HardwareAddressLength

Returns a new instance of HardwareAddressLength.



19
20
21
# File 'lib/lib/bootp/packet/hardware_address_length.rb', line 19

def initialize(hlen=6)
  @hlen = hlen.to_i
end

Class Method Details

.unpack(hlen) ⇒ Object



31
32
33
# File 'lib/lib/bootp/packet/hardware_address_length.rb', line 31

def self.unpack(hlen)
  self.new hlen.unpack('C').first
end

Instance Method Details

#<=>(other) ⇒ Object



27
28
29
# File 'lib/lib/bootp/packet/hardware_address_length.rb', line 27

def <=>(other)
  self.to_i <=> other.to_i
end

#packObject



23
24
25
# File 'lib/lib/bootp/packet/hardware_address_length.rb', line 23

def pack
  [@hlen.to_i].pack('C')
end