Class: Docker::Asset
- Inherits:
-
Object
- Object
- Docker::Asset
- Defined in:
- lib/docker/asset.rb
Overview
Base class for containers, images and other Docker assets.
Direct Known Subclasses
Instance Method Summary collapse
-
#initialize(json, session: nil) ⇒ Asset
constructor
A new instance of Asset.
- #inspect ⇒ Object
-
#name ⇒ String
Human-readable name of container, image or volume.
- #to_h ⇒ Object
- #to_s ⇒ Object
Constructor Details
#initialize(json, session: nil) ⇒ Asset
Returns a new instance of Asset.
4 5 6 7 8 |
# File 'lib/docker/asset.rb', line 4 def initialize(json, session:nil) json = JSON.load(json) if json.is_a?(String) @json = json @session = session end |
Instance Method Details
#inspect ⇒ Object
10 11 12 |
# File 'lib/docker/asset.rb', line 10 def inspect %Q{#<#{self.class.name}:#{self.name}>} end |
#name ⇒ String
Returns human-readable name of container, image or volume.
15 16 17 |
# File 'lib/docker/asset.rb', line 15 def name @json['Name'] end |
#to_h ⇒ Object
19 20 21 |
# File 'lib/docker/asset.rb', line 19 def to_h @json end |
#to_s ⇒ Object
23 24 25 |
# File 'lib/docker/asset.rb', line 23 def to_s self.inspect end |