Class: RuleEngine
- Inherits:
-
Object
- Object
- RuleEngine
- Defined in:
- lib/rule_engine.rb
Instance Attribute Summary collapse
-
#rules ⇒ Object
readonly
Returns the value of attribute rules.
Instance Method Summary collapse
-
#initialize ⇒ RuleEngine
constructor
A new instance of RuleEngine.
- #scan(workflow) ⇒ Object
Constructor Details
#initialize ⇒ RuleEngine
Returns a new instance of RuleEngine.
4 5 6 7 |
# File 'lib/rule_engine.rb', line 4 def initialize @rules = [] load_rules end |
Instance Attribute Details
#rules ⇒ Object (readonly)
Returns the value of attribute rules.
2 3 4 |
# File 'lib/rule_engine.rb', line 2 def rules @rules end |
Instance Method Details
#scan(workflow) ⇒ Object
9 10 11 12 13 14 15 16 17 18 19 |
# File 'lib/rule_engine.rb', line 9 def scan(workflow) findings = [] @rules.each do |rule| begin findings.concat(rule.check(workflow)) rescue => e $stderr.puts "Rule #{rule.name} failed on #{workflow.filename}: #{e.}" end end findings.sort end |