Method: VirtualBox::Net::Dhcp.ip_stob

Defined in:
lib/virtual_box/net/dhcp.rb

.ip_stob(ip_string) ⇒ Integer

Converts an IP string into a number.

Parameters:

  • ip_string (String)

    an IP address using the dot (.) notation

Returns:

  • (Integer)

    the IP adddres, encoded as a 32-bit big-endian number



145
146
147
# File 'lib/virtual_box/net/dhcp.rb', line 145

def self.ip_stob(ip_string)
  ip_string.split('.').map(&:to_i).pack('C*').unpack('N').first
end