class Lib::BOOTP::Packet::HopCount

Public Class Methods

new(hops=0) click to toggle source
# File lib/lib/bootp/packet/hop_count.rb, line 18
def initialize(hops=0)
  raise ArgumentError, "Hop Count out of range: #{hops}" if hops > 255
  @hops = hops
end
unpack(hops) click to toggle source
# File lib/lib/bootp/packet/hop_count.rb, line 31
def self.unpack(hops)
  self.new hops.unpack('C').first
end

Public Instance Methods

<=>(other) click to toggle source
# File lib/lib/bootp/packet/hop_count.rb, line 23
def <=>(other)
  self.to_i <=> other.to_i
end
pack() click to toggle source
# File lib/lib/bootp/packet/hop_count.rb, line 27
def pack
  [@hops.to_i].pack('C')
end