Class: Jisota::CompositeScript

Inherits:
Object
  • Object
show all
Defined in:
lib/jisota/composite_script.rb

Overview

Part of the Script duck type

Contains a list of Scripts and can execute them consectutive. If one script fails, the following will not be executed and the combined result of this script will also be failed (‘false`)

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initializeCompositeScript

Returns a new instance of CompositeScript.



11
12
13
# File 'lib/jisota/composite_script.rb', line 11

def initialize
  @scripts = []
end

Instance Attribute Details

#scriptsObject

Returns the value of attribute scripts.



9
10
11
# File 'lib/jisota/composite_script.rb', line 9

def scripts
  @scripts
end

Instance Method Details

#execute(ssh_session, logger = nil) ⇒ Object



15
16
17
18
19
20
21
# File 'lib/jisota/composite_script.rb', line 15

def execute(ssh_session, logger = nil)
  scripts.each do |inner|
    result = inner.execute(ssh_session, logger)
    return false unless result
  end
  true
end