class Lib::BOOTP::Packet::OpCode
Public Class Methods
new(op=1)
click to toggle source
# File lib/lib/bootp/packet/op_code.rb, line 18 def initialize(op=1) raise ArgumentError, "OP Code out of range : #{op}" unless [1,2].include? op.to_i @op = op end
unpack(op)
click to toggle source
# File lib/lib/bootp/packet/op_code.rb, line 40 def self.unpack(op) self.new op.unpack('C').first end
Public Instance Methods
<=>(other)
click to toggle source
# File lib/lib/bootp/packet/op_code.rb, line 31 def <=>(other) return self.to_i <=> other if other.is_a?(Integer) self.to_s <=> other.to_s.upcase end
pack()
click to toggle source
# File lib/lib/bootp/packet/op_code.rb, line 36 def pack [@op.to_i].pack('C') end
to_s()
click to toggle source
# File lib/lib/bootp/packet/op_code.rb, line 23 def to_s if @op == 1 'BOOTREQUEST' elsif @op == 2 'BOOTREPLY' end end