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.



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

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

Class Method Details

.unpack(hlen) ⇒ Object



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

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

Instance Method Details

#<=>(other) ⇒ Object



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

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

#packObject



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

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