Class: IPAddr

Inherits:
Object show all
Extended by:
JamfRubyExtensions::IPAddr::Utils
Defined in:
lib/jamf/ruby_extensions/ipaddr.rb

Overview

A few augmentations to IPAddr handling.

Direct Known Subclasses

Jamf::IPAddress

Class Method Summary collapse

Class Method Details

.j_cidr_from_ends(starting, ending) ⇒ FixNum Also known as: jss_cidr_from_ends Originally defined in module JamfRubyExtensions::IPAddr::Utils

Given starting and ending IPv4 IP addresses (either Strings or IPAddrs) return the CIDR notation routing prefix mask

Examples:

IPAddr.j_cidr_from_ends '10.0.0.0', '10.0.0.255' # => 24

Parameters:

  • starting (Strings, IPAddr)

    the starting IP address

  • ending (Strings, IPAddr)

    the ending IP address

Returns:

  • (FixNum)

    the CIDR notation routing prefix mask

.j_ending_address(starting, cidr) ⇒ IPAddr Also known as: jss_ending_address Originally defined in module JamfRubyExtensions::IPAddr::Utils

Convert a starting address (either String or IPAddr) and a CIDR notation routing prefix mask into the IPv4 address of at the end of the range of addresses.

Examples:

IPAddr.j_ending_address '10.0.0.0', 24 # => #<IPAddr: IPv4:10.0.0.255>

Parameters:

  • starting (Strings, IPAddr)

    the starting IP address

  • cidr (FixNum)

    the CIDR mask

Returns:

  • (IPAddr)

    the ending IP address of the range.

.j_masked_v4addr(starting, ending) ⇒ IPAddr Also known as: jss_masked_v4addr Originally defined in module JamfRubyExtensions::IPAddr::Utils

Convert starting and ending IPv4 IP addresses (either Strings or IPAddrs) into a single masked IPv4 IPAddr

Examples:

IPAddr.j_masked_v4addr '10.0.0.0', '10.0.0.255' # => #<IPAddr: IPv4:10.0.0.0/255.255.255.0>

Parameters:

  • starting (Strings, IPAddr)

    the starting IP address

  • ending (Strings, IPAddr)

    the ending IP address

Returns:

  • (IPAddr)

    the IP address range represented as a masked IPv4 address