Class: Inspec::Resources::DockerPlugin

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

Instance Method Summary collapse

Constructor Details

#initialize(opts = {}) ⇒ DockerPlugin

Returns a new instance of DockerPlugin.



25
26
27
28
29
30
# File 'lib/inspec/resources/docker_plugin.rb', line 25

def initialize(opts = {})
  # do sanitizion of input values
  o = opts.dup
  o = { name: opts } if opts.is_a?(String)
  @opts = o
end

Instance Method Details

#enabled?Boolean

Returns:

  • (Boolean)


36
37
38
# File 'lib/inspec/resources/docker_plugin.rb', line 36

def enabled?
  object_info.enabled[0]
end

#exist?Boolean

Returns:

  • (Boolean)


32
33
34
# File 'lib/inspec/resources/docker_plugin.rb', line 32

def exist?
  object_info.entries.size == 1
end

#idObject



40
41
42
# File 'lib/inspec/resources/docker_plugin.rb', line 40

def id
  object_info.ids[0] if object_info.entries.size == 1
end

#resource_idObject



53
54
55
# File 'lib/inspec/resources/docker_plugin.rb', line 53

def resource_id
  id || @opts[:id] || @opts[:name] || ""
end

#to_sObject



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

def to_s
  plugin = @opts[:name] || @opts[:id]
  "Docker plugin #{plugin}"
end

#versionObject



44
45
46
# File 'lib/inspec/resources/docker_plugin.rb', line 44

def version
  object_info.versions[0] if object_info.entries.size == 1
end