Class: DC::Image
- Inherits:
-
Object
- Object
- DC::Image
- Defined in:
- lib/dc.rb
Instance Attribute Summary collapse
-
#name ⇒ Object
readonly
Returns the value of attribute name.
Class Method Summary collapse
Instance Method Summary collapse
- #build ⇒ Object
- #exist? ⇒ Boolean
-
#initialize(name, directory: name) ⇒ Image
constructor
A new instance of Image.
Constructor Details
#initialize(name, directory: name) ⇒ Image
Returns a new instance of Image.
75 76 77 78 79 |
# File 'lib/dc.rb', line 75 def initialize name, directory: name @name = name @directory = directory self.class[name] = self end |
Instance Attribute Details
#name ⇒ Object (readonly)
Returns the value of attribute name.
81 82 83 |
# File 'lib/dc.rb', line 81 def name @name end |
Class Method Details
.[](name) ⇒ Object
66 67 68 |
# File 'lib/dc.rb', line 66 def [] name all[name] end |
.[]=(name, image) ⇒ Object
70 71 72 |
# File 'lib/dc.rb', line 70 def []= name, image all[name] = image end |
.all ⇒ Object
62 63 64 |
# File 'lib/dc.rb', line 62 def all @all ||= {} end |
Instance Method Details
#build ⇒ Object
87 88 89 90 91 92 93 94 |
# File 'lib/dc.rb', line 87 def build build_parent_image_if_available image = Docker::Image.build_from_dir @directory do |json| puts JSON.parse json end image.tag repo: @name image end |
#exist? ⇒ Boolean
83 84 85 |
# File 'lib/dc.rb', line 83 def exist? Docker::Image.exist? @name end |