Class: Kuby::Docker::Dockerfile::Copy

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(source, dest, from: nil) ⇒ Copy

T::Sig::WithoutRuntime.sig { params(source: String, dest: String, from: T.nilable(String)).void }



74
75
76
77
78
# File 'lib/kuby/docker/dockerfile.rb', line 74

def initialize(source, dest, from: nil)
  @source = source
  @dest = dest
  @from = from
end

Instance Attribute Details

#destObject (readonly)

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



68
69
70
# File 'lib/kuby/docker/dockerfile.rb', line 68

def dest
  @dest
end

#fromObject (readonly)

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



71
72
73
# File 'lib/kuby/docker/dockerfile.rb', line 71

def from
  @from
end

#sourceObject (readonly)

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



65
66
67
# File 'lib/kuby/docker/dockerfile.rb', line 65

def source
  @source
end

Instance Method Details

#to_sObject

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



81
82
83
84
85
86
# File 'lib/kuby/docker/dockerfile.rb', line 81

def to_s
  cmd = ['COPY']
  cmd << "--from=#{from}" if from
  cmd += [source, dest]
  cmd.join(' ')
end