Class: Flotte::Role

Inherits:
Object
  • Object
show all
Defined in:
lib/flotte/role.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(name:, service:, hosts:, command: [], environment: {}) ⇒ Role

Returns a new instance of Role.



14
15
16
17
18
19
20
# File 'lib/flotte/role.rb', line 14

def initialize(name:, service:, hosts:, command: [], environment: {})
  @name = name
  @service = service
  @hosts = hosts
  @command = command
  @environment = environment
end

Instance Attribute Details

#commandArray<String> (readonly)

Returns:

  • (Array<String>)


10
11
12
# File 'lib/flotte/role.rb', line 10

def command
  @command
end

#environmentString (readonly)

Returns:

  • (String)


4
5
6
# File 'lib/flotte/role.rb', line 4

def environment
  @environment
end

#hostsArray<Flotte::Host> (readonly)

Returns:



8
9
10
# File 'lib/flotte/role.rb', line 8

def hosts
  @hosts
end

#nameString (readonly)

Returns:

  • (String)


4
5
6
# File 'lib/flotte/role.rb', line 4

def name
  @name
end

#serviceFlotte::Service (readonly)

Returns:



6
7
8
# File 'lib/flotte/role.rb', line 6

def service
  @service
end

Instance Method Details

#idString

Returns:

  • (String)


23
24
25
# File 'lib/flotte/role.rb', line 23

def id
  "#{service.name}.#{name}"
end

#imageString

Returns:

  • (String)


12
# File 'lib/flotte/role.rb', line 12

delegate :image, to: :service

#name_for_containerObject



27
28
29
# File 'lib/flotte/role.rb', line 27

def name_for_container
  id
end