Class: Indocker::DockerDirectives::Copy

Inherits:
Base show all
Defined in:
lib/indocker/directives/docker_directives/copy.rb

Instance Attribute Summary collapse

Attributes inherited from Base

#args

Instance Method Summary collapse

Methods inherited from Indocker::Directives::Base

#build_directive?, #container_directive?, #partial?

Constructor Details

#initialize(context:, copy_actions:, compile: false) ⇒ Copy

Returns a new instance of Copy.



4
5
6
7
8
# File 'lib/indocker/directives/docker_directives/copy.rb', line 4

def initialize(context:, copy_actions:, compile: false)
  @copy_actions = copy_actions
  @context      = context
  @compile      = compile
end

Instance Attribute Details

#compile ⇒ Object (readonly)

Returns the value of attribute compile.



2
3
4
# File 'lib/indocker/directives/docker_directives/copy.rb', line 2

def compile
  @compile
end

#context ⇒ Object (readonly)

Returns the value of attribute context.



2
3
4
# File 'lib/indocker/directives/docker_directives/copy.rb', line 2

def context
  @context
end

#copy_actions ⇒ Object (readonly)

Returns the value of attribute copy_actions.



2
3
4
# File 'lib/indocker/directives/docker_directives/copy.rb', line 2

def copy_actions
  @copy_actions
end

Instance Method Details

#prepare_directive? ⇒ Boolean

Returns:

  • (Boolean)


24
25
26
# File 'lib/indocker/directives/docker_directives/copy.rb', line 24

def prepare_directive?
  true
end

#to_s ⇒ Object



14
15
16
17
18
19
20
21
22
# File 'lib/indocker/directives/docker_directives/copy.rb', line 14

def to_s
  result = []
  
  copy_actions.each do |from, to|
    result.push "#{type} #{from} #{to}"
  end

  result.join("\n")
end

#type ⇒ Object



10
11
12
# File 'lib/indocker/directives/docker_directives/copy.rb', line 10

def type
  'COPY'
end