Class: Serverspec::Type::DockerBase
- Inherits:
-
Base
- Object
- Base
- Serverspec::Type::DockerBase
show all
- Defined in:
- lib/serverspec/type/docker_base.rb
Instance Attribute Summary
Attributes inherited from Base
#name
Instance Method Summary
collapse
Methods inherited from Base
#initialize, #inspect, #to_ary, #to_s
Instance Method Details
#[](key) ⇒ Object
9
10
11
12
13
14
15
16
|
# File 'lib/serverspec/type/docker_base.rb', line 9
def [](key)
value = inspection
key.split('.').each do |k|
is_index = k.start_with?('[') && k.end_with?(']')
value = value[is_index ? k[1..-2].to_i : k]
end
value
end
|
#exist? ⇒ Boolean
5
6
7
|
# File 'lib/serverspec/type/docker_base.rb', line 5
def exist?
get_inspection.success?
end
|
#inspection ⇒ Object
18
19
20
|
# File 'lib/serverspec/type/docker_base.rb', line 18
def inspection
@inspection ||= ::MultiJson.load(get_inspection.stdout)[0]
end
|