class Lib::BOOTP::Packet::ServerHostName

Public Class Methods

new(sname='.') click to toggle source
# File lib/lib/bootp/packet/server_host_name.rb, line 17
def initialize(sname='.')
  raise ArgumentError, "Can't convert #{sname.class.name} to String" unless sname.respond_to? :to_s
  raise ArgumentError, "Given Server Host Name is to long: #{sname}" if sname.to_s.size > 64
  @sname = sname.to_s
end
unpack(packet) click to toggle source
# File lib/lib/bootp/packet/server_host_name.rb, line 31
def self.unpack(packet)
  new packet.unpack('a64').first.to_s
end

Public Instance Methods

<=>(other) click to toggle source
# File lib/lib/bootp/packet/server_host_name.rb, line 23
def <=>(other)
  self.to_s <=> other.to_s
end
pack() click to toggle source
# File lib/lib/bootp/packet/server_host_name.rb, line 27
def pack
  [@sname].pack('a64')
end