Class: Jisota::CompositeScript
- Inherits:
-
Object
- Object
- Jisota::CompositeScript
- 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
-
#scripts ⇒ Object
Returns the value of attribute scripts.
Instance Method Summary collapse
- #execute(context) ⇒ Object
-
#initialize ⇒ CompositeScript
constructor
A new instance of CompositeScript.
Constructor Details
#initialize ⇒ CompositeScript
Returns a new instance of CompositeScript.
11 12 13 |
# File 'lib/jisota/composite_script.rb', line 11 def initialize @scripts = [] end |
Instance Attribute Details
#scripts ⇒ Object
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(context) ⇒ Object
15 16 17 18 19 20 21 |
# File 'lib/jisota/composite_script.rb', line 15 def execute(context) scripts.each do |inner| result = inner.execute(context) return false unless result end true end |