Class: DHCP::OptIP

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

Overview

Class for DHCP options that contain a single IPv4 address

Instance Attribute Summary

Attributes inherited from OptData

#data

Attributes inherited from Opt

#name, #opt

Instance Method Summary collapse

Methods inherited from OptFixedData

#data=, #initialize

Methods inherited from OptData

#get, #initialize, #opt_header, #set, #to_opt, #to_s

Methods inherited from Opt

#initialize, #opt_header, #to_opt, #to_s

Constructor Details

This class inherits a constructor from DHCP::OptFixedData

Instance Method Details

#bin_to_data(data) ⇒ Object



326
327
328
# File 'lib/dhcp/options.rb', line 326

def bin_to_data(data)
  IPAddress::IPv4::parse_data(data).to_s
end

#data_to_bin(data) ⇒ Object



330
331
332
# File 'lib/dhcp/options.rb', line 330

def data_to_bin(data)
  IPAddress::IPv4.new(data).data   ## Will raise exception if data is not a valid IP
end