Class: Foreman::Procfile

Inherits:
Object
  • Object
show all
Defined in:
lib/foreman/procfile.rb

Overview

A valid Procfile entry is captured by this regex. All other lines are ignored.

/^([A-Za-z0-9_]+):s*(.+)$/

$1 = name $2 = command

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(filename) ⇒ Procfile

Returns a new instance of Procfile.



16
17
18
# File 'lib/foreman/procfile.rb', line 16

def initialize(filename)
  @entries = parse_procfile(filename)
end

Instance Attribute Details

#entriesObject (readonly)

Returns the value of attribute entries.



14
15
16
# File 'lib/foreman/procfile.rb', line 14

def entries
  @entries
end

Instance Method Details

#[](name) ⇒ Object



20
21
22
# File 'lib/foreman/procfile.rb', line 20

def [](name)
  entries.detect { |entry| entry.name == name }
end

#process_namesObject



24
25
26
# File 'lib/foreman/procfile.rb', line 24

def process_names
  entries.map(&:name)
end