Class: DeviceAtlas::Carrier::CarrierData

Inherits:
Object
  • Object
show all
Defined in:
lib/deviceatlas/carrier/carrier_data.rb

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initializeCarrierData

Returns a new instance of CarrierData.

Instance Attribute Details

Returns the value of attribute copyright.

#creation_dateObject (readonly)

Returns the value of attribute creation_date.

#property_data_typesObject (readonly)

Returns the value of attribute property_data_types.

#property_namesObject (readonly)

Returns the value of attribute property_names.

#property_names_stringsObject (readonly)

Returns the value of attribute property_names_strings.

#versionObject (readonly)

Returns the value of attribute version.

Class Method Details

.ip_to_i(ip_str) ⇒ Integer

Returns the integer representation of an IP address passed as String.

Parameters:

  • ip_str (String)

    the IP address

Returns:

  • (Integer)

    the integer representation of str

Raises:

  • (ArgumentError)

    whether str is a valid IPv4 or IPv6 address

Instance Method Details

#load_data_from_file(file_path) ⇒ Object

Load carrier data file.

file_path

carrier data file

#properties(key) ⇒ Object

Selects a value for a given IP address, traversing tree and choosing most specific value available for a given address.

key

IPv4/IPv6 address to look up in integer or string form

return

Value at most specific IPv4 network in a tree for a given IPv4

address