class Lib::BOOTP::Packet::Seconds

Public Class Methods

new(secs=0) click to toggle source
# File lib/lib/bootp/packet/seconds.rb, line 18
def initialize(secs=0)
  raise ArgumentError, "Seconds count out of range #{secs}" if secs.to_i < 0 or secs.to_i > 0xFFFF
  @secs = secs
end
unpack(secs) click to toggle source
# File lib/lib/bootp/packet/seconds.rb, line 31
def self.unpack(secs)
  self.new secs.unpack('n').first
end

Public Instance Methods

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