Class: Inspec::Resources::DockerPlugin
- Inherits:
-
Object
- Object
- Inspec::Resources::DockerPlugin
- Defined in:
- lib/inspec/resources/docker_plugin.rb
Instance Method Summary collapse
- #enabled? ⇒ Boolean
- #exist? ⇒ Boolean
- #id ⇒ Object
-
#initialize(opts = {}) ⇒ DockerPlugin
constructor
A new instance of DockerPlugin.
- #resource_id ⇒ Object
- #to_s ⇒ Object
- #version ⇒ Object
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
36 37 38 |
# File 'lib/inspec/resources/docker_plugin.rb', line 36 def enabled? object_info.enabled[0] end |
#exist? ⇒ Boolean
32 33 34 |
# File 'lib/inspec/resources/docker_plugin.rb', line 32 def exist? object_info.entries.size == 1 end |
#id ⇒ Object
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_id ⇒ Object
53 54 55 |
# File 'lib/inspec/resources/docker_plugin.rb', line 53 def resource_id id || @opts[:id] || @opts[:name] || "" end |
#to_s ⇒ Object
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 |
#version ⇒ Object
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 |