Class: Jamf::IPAddress

Inherits:
IPAddr show all
Defined in:
lib/jamf/api/jamf_pro/other_classes/ip_address.rb

Overview

A wrapper for IPAddr - allowing initialize to take an unused cnx: and providing #to_jamf

Instance Method Summary collapse

Constructor Details

#initialize(an_ip) ⇒ IPAddress

Returns a new instance of IPAddress.

Parameters:

  • an_ip (String, IPAddr)
  • cnx (void)

    unused, but required



22
23
24
25
26
27
28
29
# File 'lib/jamf/api/jamf_pro/other_classes/ip_address.rb', line 22

def initialize(an_ip)
  if an_ip.nil?
    @empty_ip = true
    return
  end

  super an_ip
end

Instance Method Details

#to_jamfString

Returns the IP formatted for passing to the API as a string.

Returns:

  • (String)

    the IP formatted for passing to the API as a string.



33
34
35
36
37
# File 'lib/jamf/api/jamf_pro/other_classes/ip_address.rb', line 33

def to_jamf
  return Jamf::BLANK if @empty_ip

  to_s
end