Class: BatchExperiment::PyaExtractor
- Inherits:
-
Object
- Object
- BatchExperiment::PyaExtractor
- Extended by:
- Extractor
- Defined in:
- lib/batch_experiment/sample_extractors.rb
Overview
Extractor for the output of the pyasukp program available at github.com/henriquebecker91/masters. Not of interest for the majority of the users of this gem. Kept as example, and for this gem author personal use.
Class Method Summary collapse
-
.extract_from_lines(lines) ⇒ Array<String>
Optionally, you can define this method instead of #extract.
-
.names ⇒ Array<String>
Return the field names for each of the elements returned by extract.
Methods included from Extractor
extract, extract_from_lines, get_field, get_hfield, names
Class Method Details
.extract_from_lines(lines) ⇒ Array<String>
Optionally, you can define this method instead of #extract. The #extract method will call this method if not overrided.
60 61 62 63 64 65 66 |
# File 'lib/batch_experiment/sample_extractors.rb', line 60 def self.extract_from_lines(lines) values = ['Total Time ', 'ext_time', 'ext_mem'].map do | label | Extractor.get_field(lines, label) end opt_key = '#The optimal value for the given capacity' values << Extractor.get_hfield(lines, opt_key) end |
.names ⇒ Array<String>
Note:
To be on the safe side you should create a new array at each call. If you always return a reference to the same array the array can be modified.
Return the field names for each of the elements returned by extract. Ex.:
['Time', 'Max Mem Use', 'opt', ... ]
55 56 57 |
# File 'lib/batch_experiment/sample_extractors.rb', line 55 def self.names ['internal_time', 'external_time', 'external_memory', 'opt'] end |