Class: Matrixeval::DockerCompose::File

Inherits:
Object
  • Object
show all
Defined in:
lib/matrixeval/docker_compose/file.rb

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(context) ⇒ File

Returns a new instance of File.



23
24
25
# File 'lib/matrixeval/docker_compose/file.rb', line 23

def initialize(context)
  @context = context
end

Instance Attribute Details

#contextObject (readonly)

Returns the value of attribute context.



21
22
23
# File 'lib/matrixeval/docker_compose/file.rb', line 21

def context
  @context
end

Class Method Details

.create_allObject



6
7
8
9
10
11
12
# File 'lib/matrixeval/docker_compose/file.rb', line 6

def create_all
  FileUtils.mkdir_p folder

  Context.all.each do |context|
    new(context).create
  end
end

Instance Method Details

#createObject



27
28
29
30
31
# File 'lib/matrixeval/docker_compose/file.rb', line 27

def create
  ::File.open(docker_compose_file_path, 'w+') do |file|
    file.puts build_content
  end
end