Class: Serverspec::Type::DockerBase

Inherits:
Base
  • Object
show all
Defined in:
lib/serverspec/type/docker_base.rb

Direct Known Subclasses

DockerContainer, DockerImage

Instance Attribute Summary

Attributes inherited from Base

#name

Instance Method Summary collapse

Methods inherited from Base

#initialize, #inspect, #to_ary, #to_s

Constructor Details

This class inherits a constructor from Serverspec::Type::Base

Instance Method Details

#[](key) ⇒ Object


9
10
11
12
13
14
15
# File 'lib/serverspec/type/docker_base.rb', line 9

def [](key)
  value = inspection
  key.split('.').each do |k|
    value = value[k]
  end
  value
end

#exist?Boolean

Returns:

  • (Boolean)

5
6
7
# File 'lib/serverspec/type/docker_base.rb', line 5

def exist?
  get_inspection.success?
end

#inspectionObject


17
18
19
20
# File 'lib/serverspec/type/docker_base.rb', line 17

def inspection
  return @inspection if @inspection
  @inspection = ::MultiJson.load(get_inspection.stdout)[0]
end