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



40
41
42
43
44
45
46
47
48
# File 'lib/jamf/api/jamf_pro/other_classes/ip_address.rb', line 40

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.



52
53
54
55
# File 'lib/jamf/api/jamf_pro/other_classes/ip_address.rb', line 52

def to_jamf
  return Jamf::BLANK if @empty_ip
  to_s
end