Method: Lib::BOOTP::Packet::HopCount#initialize

Defined in:
lib/lib/bootp/packet/hop_count.rb

#initialize(hops = 0) ⇒ HopCount

Returns a new instance of HopCount.

Raises:

  • (ArgumentError)


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

def initialize(hops=0)
  @hops = hops.to_i #.is_a?(Hash) ? hops.transform_keys(&:to_sym)[:code].to_i : hops.to_i
  raise ArgumentError, "Hop Count out of range: #{@hops}" if @hops > 255
end