class DHCP::OptData
Class for DHCP
options that contain data
Attributes
data[RW]
Public Class Methods
new(opt, name, data=nil)
click to toggle source
Calls superclass method
DHCP::Opt::new
# File lib/dhcp/options.rb, line 67 def initialize(opt, name, data=nil) super(opt, name) @data = data.nil? ? '' : data_to_bin(data) end
Public Instance Methods
bin_to_data(data)
click to toggle source
# File lib/dhcp/options.rb, line 95 def bin_to_data(data) ## Override this in subclasses to interpret data data end
data=(data)
click to toggle source
# File lib/dhcp/options.rb, line 77 def data=(data) @data = data.dup self ## Chainable end
data_to_bin(data)
click to toggle source
# File lib/dhcp/options.rb, line 91 def data_to_bin(data) ## Override this in subclasses to interpret data data end
get()
click to toggle source
# File lib/dhcp/options.rb, line 87 def get bin_to_data(@data) end
opt_header()
click to toggle source
Calls superclass method
DHCP::Opt#opt_header
# File lib/dhcp/options.rb, line 99 def opt_header super + "(#{data.size})" end
set(data)
click to toggle source
# File lib/dhcp/options.rb, line 82 def set(data) self.data = data_to_bin(data) self ## Chainable end
to_opt()
click to toggle source
Calls superclass method
DHCP::Opt#to_opt
# File lib/dhcp/options.rb, line 107 def to_opt super + @data.size.chr + @data end
to_s()
click to toggle source
# File lib/dhcp/options.rb, line 103 def to_s opt_header + "='#{bin_to_data(@data)}'" end