Class: Kuby::Docker::Dockerfile::From

Inherits:
Command
  • Object
show all
Defined in:
lib/kuby/docker/dockerfile.rb

Instance Attribute Summary collapse

Attributes inherited from Command

#args

Instance Method Summary collapse

Constructor Details

#initialize(image_url, as: nil) ⇒ From

T::Sig::WithoutRuntime.sig { params(image_url: String, as: T.nilable(String)).void }



35
36
37
38
# File 'lib/kuby/docker/dockerfile.rb', line 35

def initialize(image_url, as: nil)
  @image_url = image_url
  @as = as
end

Instance Attribute Details

#asObject (readonly)

T::Sig::WithoutRuntime.sig { returns(T.nilable(String)) }



32
33
34
# File 'lib/kuby/docker/dockerfile.rb', line 32

def as
  @as
end

#image_urlObject (readonly)

T::Sig::WithoutRuntime.sig { returns(String) }



29
30
31
# File 'lib/kuby/docker/dockerfile.rb', line 29

def image_url
  @image_url
end

Instance Method Details

#to_sObject

T::Sig::WithoutRuntime.sig { returns(String) }



41
42
43
44
45
# File 'lib/kuby/docker/dockerfile.rb', line 41

def to_s
  str = "FROM #{image_url}"
  str << " AS #{as}" if as
  str
end