Class: DockerPlugin
- Inherits:
-
Object
- Object
- DockerPlugin
- Defined in:
- lib/inspec-docker-resources/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.
24 25 26 27 28 29 |
# File 'lib/inspec-docker-resources/resources/docker_plugin.rb', line 24 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
35 36 37 |
# File 'lib/inspec-docker-resources/resources/docker_plugin.rb', line 35 def enabled? object_info.enabled[0] end |
#exist? ⇒ Boolean
31 32 33 |
# File 'lib/inspec-docker-resources/resources/docker_plugin.rb', line 31 def exist? object_info.entries.size == 1 end |
#id ⇒ Object
39 40 41 |
# File 'lib/inspec-docker-resources/resources/docker_plugin.rb', line 39 def id object_info.ids[0] if object_info.entries.size == 1 end |
#resource_id ⇒ Object
52 53 54 |
# File 'lib/inspec-docker-resources/resources/docker_plugin.rb', line 52 def resource_id id || @opts[:id] || @opts[:name] || "" end |
#to_s ⇒ Object
47 48 49 50 |
# File 'lib/inspec-docker-resources/resources/docker_plugin.rb', line 47 def to_s plugin = @opts[:name] || @opts[:id] "Docker plugin #{plugin}" end |
#version ⇒ Object
43 44 45 |
# File 'lib/inspec-docker-resources/resources/docker_plugin.rb', line 43 def version object_info.versions[0] if object_info.entries.size == 1 end |