Class: Wallace::Analyser
- Inherits:
-
Object
- Object
- Wallace::Analyser
- Defined in:
- lib/core/analyser.rb
Overview
Analysers are used to analyse the current state of the evolution at given stages. These objects may be used to gather data, calculate statistics and log information during the evolution.
Analysers may harness the outputs of attached analysers to supplement their input data. This ability can be exploited to perform multi-stage post-processing and to efficiently record information.
Direct Known Subclasses
Instance Attribute Summary collapse
-
#inputs ⇒ Object
readonly
Returns the value of attribute inputs.
Instance Method Summary collapse
-
#initialize(inputs) ⇒ Analyser
constructor
Constructs a new analyser.
-
#run(stage, state) ⇒ Object
Runs this analyser at a given stage in the evolution.
Constructor Details
#initialize(inputs) ⇒ Analyser
Constructs a new analyser.
Parameters:
-
inputs, the input analysers which feed data into this analyser.
16 17 18 |
# File 'lib/core/analyser.rb', line 16 def initialize(inputs) @inputs = inputs end |
Instance Attribute Details
#inputs ⇒ Object (readonly)
Returns the value of attribute inputs.
10 11 12 |
# File 'lib/core/analyser.rb', line 10 def inputs @inputs end |
Instance Method Details
#run(stage, state) ⇒ Object
Runs this analyser at a given stage in the evolution.
Executes the input analysers to gather the input data which is then fed into the appropriate stage handler of this analyser.
Parameters:
-
stage, the current stage in the evolution.
-
state, the current state of the evolution.
Returns: Output data for processing by any attached analysers.
31 32 33 34 |
# File 'lib/core/analyser.rb', line 31 def run(stage, state) input_data = @inputs.map { |i| i.run(stage, state) } self.method(stage).invoke(state, input_data) end |