Class: Inspec::Resources::Port

Inherits:
Object
  • Object
show all
Defined in:
lib/inspec/resources/port.rb

Instance Method Summary collapse

Constructor Details

#initialize(*args) ⇒ Port

Returns a new instance of Port.



25
26
27
28
29
30
31
32
33
34
35
36
37
# File 'lib/inspec/resources/port.rb', line 25

def initialize(*args)
  args.unshift(nil) if args.length <= 1 # add the ip address to the front
  @ip = args[0]
  @port = if args[1].nil?
            nil
          else
            args[1].to_i
          end

  @cache = nil
  @port_manager = port_manager_for_os
  return skip_resource "The `port` resource is not supported on your OS yet." if @port_manager.nil?
end

Instance Method Details

#to_sObject



48
49
50
# File 'lib/inspec/resources/port.rb', line 48

def to_s
  "Port #{@port}"
end