Class: Devup::Compose::V1::Processes

Inherits:
Object
  • Object
show all
Defined in:
lib/devup/compose/v1/processes.rb

Direct Known Subclasses

Devup::Compose::V2::Processes

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(output) ⇒ Processes

Returns a new instance of Processes.



8
9
10
# File 'lib/devup/compose/v1/processes.rb', line 8

def initialize(output)
  @output = output
end

Instance Attribute Details

#outputObject (readonly)

Returns the value of attribute output.



7
8
9
# File 'lib/devup/compose/v1/processes.rb', line 7

def output
  @output
end

Instance Method Details

#port_mapping(port) ⇒ Object



18
19
20
21
22
23
24
# File 'lib/devup/compose/v1/processes.rb', line 18

def port_mapping(port)
  m = output.match(/\d{1,3}.\d{1,3}.\d{1,3}.\d{1,3}:(\d+)->#{port}\/tcp/)

  return PortMapping.new(port, nil) if m.nil?

  PortMapping.new(port, m[1].to_i)
end

#up?Boolean

Returns:

  • (Boolean)


12
13
14
15
16
# File 'lib/devup/compose/v1/processes.rb', line 12

def up?
  service_lines.map { |line|
    line.match(/Up/) && !line.match(/Exit/)
  }.all?
end