Class: DockerCompose::Generator::Service

Inherits:
Object
  • Object
show all
Includes:
Environment, Labels, Links, Net, Pid, Ports, Volumes
Defined in:
lib/docker-compose/generator/service.rb,
lib/docker-compose/generator/service/net.rb,
lib/docker-compose/generator/service/pid.rb,
lib/docker-compose/generator/service/links.rb,
lib/docker-compose/generator/service/ports.rb,
lib/docker-compose/generator/service/labels.rb,
lib/docker-compose/generator/service/volumes.rb,
lib/docker-compose/generator/service/environment.rb

Overview

Service Class

Used to interact with services

Defined Under Namespace

Modules: Environment, Labels, Links, Net, Pid, Ports, Volumes

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods included from Volumes

#add_volume, #drop_volume, #volume?

Methods included from Pid

#pid=

Methods included from Net

#net=

Methods included from Labels

#add_label, #drop_label, #get_label, #label?

Methods included from Environment

#add_environment, #drop_environment, #environment?, #get_environment

Methods included from Links

#add_external_link, #add_link, #drop_external_link, #drop_link, #external_link?, #link?

Methods included from Ports

#add_port, #drop_port, #port?

Constructor Details

#initialize(name, image) ⇒ Service

Initialize Method

Parameters:

  • name (String)

    The name of the service

  • image (String)

    The image to use



39
40
41
42
43
44
# File 'lib/docker-compose/generator/service.rb', line 39

def initialize(name, image)
  @name = name
  @attrs = {
    'image' => image
  }
end

Instance Attribute Details

#attrsObject (readonly)

Returns the value of attribute attrs.



30
31
32
# File 'lib/docker-compose/generator/service.rb', line 30

def attrs
  @attrs
end

#nameObject (readonly)

Returns the value of attribute name.



30
31
32
# File 'lib/docker-compose/generator/service.rb', line 30

def name
  @name
end

Instance Method Details

#import(attrs) ⇒ Object

Import the attrs hash

Parameters:

  • attrs (Hash)

    The attribute hash from the main import



86
87
88
# File 'lib/docker-compose/generator/service.rb', line 86

def import(attrs)
  @attrs = attrs
end