Class: Docker::Inspect
- Inherits:
-
Object
- Object
- Docker::Inspect
- Defined in:
- lib/docker/inspect.rb
Instance Attribute Summary collapse
-
#inspekt ⇒ Object
readonly
Returns the value of attribute inspekt.
Instance Method Summary collapse
- #env ⇒ Object
-
#initialize(id) ⇒ Inspect
constructor
A new instance of Inspect.
- #ip_address ⇒ Object
- #name ⇒ Object
- #ports ⇒ Object
- #state ⇒ Object
- #to_s ⇒ Object
Constructor Details
#initialize(id) ⇒ Inspect
Returns a new instance of Inspect.
7 8 9 10 |
# File 'lib/docker/inspect.rb', line 7 def initialize(id) @id = id[0..11] @inspekt = JSON.load(`docker inspect #{@id}`).first end |
Instance Attribute Details
#inspekt ⇒ Object (readonly)
Returns the value of attribute inspekt.
6 7 8 |
# File 'lib/docker/inspect.rb', line 6 def inspekt @inspekt end |
Instance Method Details
#env ⇒ Object
16 17 18 19 20 21 |
# File 'lib/docker/inspect.rb', line 16 def env inspekt["Config"]["Env"].each_with_object({}) do |e,h| pair = e.split('=') h[pair.first] = pair.last end end |
#ip_address ⇒ Object
23 24 25 |
# File 'lib/docker/inspect.rb', line 23 def ip_address inspekt["NetworkSettings"]["IPAddress"] end |
#name ⇒ Object
12 13 14 |
# File 'lib/docker/inspect.rb', line 12 def name inspekt["Name"][1..-1] end |
#ports ⇒ Object
27 28 29 |
# File 'lib/docker/inspect.rb', line 27 def ports inspekt["NetworkSettings"]["Ports"] end |
#state ⇒ Object
31 32 33 |
# File 'lib/docker/inspect.rb', line 31 def state inspekt["State"] end |
#to_s ⇒ Object
35 36 37 |
# File 'lib/docker/inspect.rb', line 35 def to_s inspekt.to_s end |