Class: Opsworks::Ssh::Config::Environment

Inherits:
Object
  • Object
show all
Defined in:
lib/opsworks/ssh/config/environment.rb

Constant Summary collapse

LAYER_NAME =
'app'

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(stack: nil) ⇒ Environment

Returns a new instance of Environment.



9
10
11
12
# File 'lib/opsworks/ssh/config/environment.rb', line 9

def initialize(stack: nil)
  @stack = stack
  @stack_id = stack.stack_id
end

Instance Attribute Details

#stackObject (readonly)

Returns the value of attribute stack.



7
8
9
# File 'lib/opsworks/ssh/config/environment.rb', line 7

def stack
  @stack
end

#stack_idObject (readonly)

Returns the value of attribute stack_id.



7
8
9
# File 'lib/opsworks/ssh/config/environment.rb', line 7

def stack_id
  @stack_id
end

Instance Method Details

#nameObject



14
15
16
# File 'lib/opsworks/ssh/config/environment.rb', line 14

def name
  @name ||= @stack.name.gsub(/-/, '_')
end

#serversObject



18
19
20
21
22
# File 'lib/opsworks/ssh/config/environment.rb', line 18

def servers
  instances.map do |instance|
    Server.new(instance: instance)
  end.select(&:active?)
end