Class: OpsworksHelpers::StatusChecks

Inherits:
Object
  • Object
show all
Defined in:
lib/opsworks_helpers/status_checks.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(command_block) ⇒ StatusChecks

Returns a new instance of StatusChecks.



7
8
9
10
# File 'lib/opsworks_helpers/status_checks.rb', line 7

def initialize(command_block)
  @command_block = command_block
  @result = [true, {}]
end

Instance Attribute Details

#command_blockObject (readonly)

Returns the value of attribute command_block.



4
5
6
# File 'lib/opsworks_helpers/status_checks.rb', line 4

def command_block
  @command_block
end

#resultObject

Returns the value of attribute result.



5
6
7
# File 'lib/opsworks_helpers/status_checks.rb', line 5

def result
  @result
end

Instance Method Details

#errorsObject



20
21
22
# File 'lib/opsworks_helpers/status_checks.rb', line 20

def errors
  result[1]
end

#executeObject



12
13
14
# File 'lib/opsworks_helpers/status_checks.rb', line 12

def execute
  self.result = command_block.call
end

#failed?Boolean

Returns:

  • (Boolean)


16
17
18
# File 'lib/opsworks_helpers/status_checks.rb', line 16

def failed?
  result[0] == false
end