Class: DHCP::Opt

Inherits:
Object
  • Object
show all
Defined in:
lib/dhcp/options.rb

Overview

Base class from which all DHCP options in a DHCP packet derive:

Direct Known Subclasses

OptData

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(opt, name, ignore = nil) ⇒ Opt

Returns a new instance of Opt.



45
46
47
48
# File 'lib/dhcp/options.rb', line 45

def initialize(opt, name, ignore=nil)
  @opt  = opt
  @name = name
end

Instance Attribute Details

#nameObject (readonly)

Returns the value of attribute name.



49
50
51
# File 'lib/dhcp/options.rb', line 49

def name
  @name
end

#optObject (readonly)

Returns the value of attribute opt.



49
50
51
# File 'lib/dhcp/options.rb', line 49

def opt
  @opt
end

Instance Method Details

#opt_headerObject



51
52
53
# File 'lib/dhcp/options.rb', line 51

def opt_header
  "OPTION[#{opt},#{@name}]"
end

#to_optObject



59
60
61
# File 'lib/dhcp/options.rb', line 59

def to_opt
  @opt.chr
end

#to_sObject



55
56
57
# File 'lib/dhcp/options.rb', line 55

def to_s
  opt_header
end