Module: Simplabs::Excellent::Parsing::AbcMeasure

Included in:
MethodContext, SingletonMethodContext
Defined in:
lib/simplabs/excellent/parsing/abc_measure.rb

Overview

:nodoc:

Constant Summary collapse

CONDITIONS =
[:==, :<=, :>=, :<, :>]

Instance Method Summary collapse

Instance Method Details

#abc_scoreObject



27
28
29
30
31
32
# File 'lib/simplabs/excellent/parsing/abc_measure.rb', line 27

def abc_score
  a = @assignments  ||= 0
  b = @branches     ||= 0
  c = @conditionals ||= 0
  Math.sqrt(a * a + b * b + c * c)
end

#process_call(exp) ⇒ Object



17
18
19
20
# File 'lib/simplabs/excellent/parsing/abc_measure.rb', line 17

def process_call(exp)
  handle_call(exp)
  super
end

#process_lasgn(exp) ⇒ Object



11
12
13
14
15
# File 'lib/simplabs/excellent/parsing/abc_measure.rb', line 11

def process_lasgn(exp)
  @assignments ||= 0
  @assignments += 1
  super
end

#process_vcall(exp) ⇒ Object



22
23
24
25
# File 'lib/simplabs/excellent/parsing/abc_measure.rb', line 22

def process_vcall(exp)
  handle_call(exp)
  super
end