Class: Indocker::DockerDirectives::From
- Inherits:
-
Base
- Object
- Indocker::Directives::Base
- Base
- Indocker::DockerDirectives::From
- Defined in:
- lib/indocker/directives/docker_directives/from.rb
Instance Attribute Summary collapse
-
#repo ⇒ Object
readonly
Returns the value of attribute repo.
-
#tag ⇒ Object
readonly
Returns the value of attribute tag.
Attributes inherited from Base
Instance Method Summary collapse
- #dockerhub_image? ⇒ Boolean
- #full_name ⇒ Object
-
#initialize(repo_tag, tag: nil) ⇒ From
constructor
A new instance of From.
- #to_s ⇒ Object
- #type ⇒ Object
Methods inherited from Indocker::Directives::Base
#build_directive?, #container_directive?, #partial?, #prepare_directive?
Constructor Details
#initialize(repo_tag, tag: nil) ⇒ From
Returns a new instance of From.
4 5 6 7 8 9 10 11 12 13 |
# File 'lib/indocker/directives/docker_directives/from.rb', line 4 def initialize(repo_tag, tag: nil) case repo_tag when String @repo = repo_tag.split(':')[0] @tag = tag || repo_tag.split(':')[1] || Indocker::ImageMetadata::DEFAULT_TAG else @repo = repo_tag @tag = tag || Indocker::ImageMetadata::DEFAULT_TAG end end |
Instance Attribute Details
#repo ⇒ Object (readonly)
Returns the value of attribute repo.
2 3 4 |
# File 'lib/indocker/directives/docker_directives/from.rb', line 2 def repo @repo end |
#tag ⇒ Object (readonly)
Returns the value of attribute tag.
2 3 4 |
# File 'lib/indocker/directives/docker_directives/from.rb', line 2 def tag @tag end |
Instance Method Details
#dockerhub_image? ⇒ Boolean
19 20 21 |
# File 'lib/indocker/directives/docker_directives/from.rb', line 19 def dockerhub_image? repo.is_a?(String) end |
#full_name ⇒ Object
15 16 17 |
# File 'lib/indocker/directives/docker_directives/from.rb', line 15 def full_name "#{repo}:#{tag}" end |
#to_s ⇒ Object
23 24 25 |
# File 'lib/indocker/directives/docker_directives/from.rb', line 23 def to_s "#{type} #{repo}:#{tag}" end |
#type ⇒ Object
27 28 29 |
# File 'lib/indocker/directives/docker_directives/from.rb', line 27 def type 'FROM' end |