Class: ToPass::AlgorithmReader
- Inherits:
-
FileReader
- Object
- FileReader
- ToPass::AlgorithmReader
- Defined in:
- lib/to_pass/algorithm_reader.rb
Overview
The AlgorithmReader’s primary API is to load the rules from a YAML-file into a Hash.
Algorithms are searched in a list of standard directories. Those are defined and managed in ToPass::Directories
see ToPass::Converter for usage of the loaded algorithm
Instance Attribute Summary
Attributes inherited from FileReader
Class Method Summary collapse
-
.extension ⇒ Object
:nodoc:.
Instance Method Summary collapse
-
#initialize(algorithm) ⇒ AlgorithmReader
constructor
:nodoc:.
-
#load_from_file ⇒ Object
:nodoc:.
Methods inherited from FileReader
discover, load, search_pattern, #standard_directories
Constructor Details
#initialize(algorithm) ⇒ AlgorithmReader
:nodoc:
14 15 16 |
# File 'lib/to_pass/algorithm_reader.rb', line 14 def initialize(algorithm) # :nodoc: super(algorithm, 'algorithms') end |
Class Method Details
.extension ⇒ Object
:nodoc:
19 20 21 |
# File 'lib/to_pass/algorithm_reader.rb', line 19 def extension # :nodoc: 'yml' end |
Instance Method Details
#load_from_file ⇒ Object
:nodoc:
24 25 26 27 28 29 30 |
# File 'lib/to_pass/algorithm_reader.rb', line 24 def load_from_file # :nodoc: fn = super YAML.load_file(fn.) rescue LoadError raise LoadError, "algorithm #{@file} could not be found in #{load_path.join(', ')}" if fn.nil? end |