Class: CheapCoder::AbcEvaluator
- Inherits:
-
Object
- Object
- CheapCoder::AbcEvaluator
- Defined in:
- lib/cheap_coder/abc_evaluator.rb
Instance Method Summary collapse
- #check(node) ⇒ Object
-
#initialize ⇒ AbcEvaluator
constructor
A new instance of AbcEvaluator.
- #score ⇒ Object
Constructor Details
#initialize ⇒ AbcEvaluator
Returns a new instance of AbcEvaluator.
5 6 7 8 9 10 11 |
# File 'lib/cheap_coder/abc_evaluator.rb', line 5 def initialize @detectors = { A: NodeDetector::Assignment.new, B: NodeDetector::Branch.new, C: NodeDetector::Condition.new, } end |
Instance Method Details
#check(node) ⇒ Object
17 18 19 20 21 |
# File 'lib/cheap_coder/abc_evaluator.rb', line 17 def check(node) @detectors.each_value do |detector| detector.check(node) end end |
#score ⇒ Object
13 14 15 |
# File 'lib/cheap_coder/abc_evaluator.rb', line 13 def score @detectors.transform_values(&:score) end |