Class: Exercism::Processors::ControlFlowProcessor

Inherits:
Processor
  • Object
show all
Defined in:
lib/exercism-analysis/processors/control_flow_processor.rb

Constant Summary collapse

CONTROL_FLOW =
%w(and or)

Instance Method Summary collapse

Methods inherited from Processor

#find_exp, #find_exps

Constructor Details

#initializeControlFlowProcessor

Returns a new instance of ControlFlowProcessor.



8
9
10
# File 'lib/exercism-analysis/processors/control_flow_processor.rb', line 8

def initialize
  @control_flow = []
end

Instance Method Details

#process_binary(exp) ⇒ Object Also known as: process_unary



12
13
14
15
16
# File 'lib/exercism-analysis/processors/control_flow_processor.rb', line 12

def process_binary(exp)
  if CONTROL_FLOW.include?(exp.value)
    @control_flow << exp
  end
end

#resultObject



20
21
22
# File 'lib/exercism-analysis/processors/control_flow_processor.rb', line 20

def result
  @control_flow
end