Sha256: 1c78bcdee839e95d1ee330340cbdac21587fb30610bb00d32d9ba583cdc817e6
Contents?: true
Size: 1.16 KB
Versions: 8
Compression:
Stored size: 1.16 KB
Contents
require 'simplabs/excellent/parsing/cyclomatic_complexity_measure' require 'simplabs/excellent/parsing/abc_measure' module Simplabs module Excellent module Parsing class SingletonMethodContext < MethodContext #:nodoc: include CyclomaticComplexityMeasure include AbcMeasure attr_reader :parameters attr_reader :calls def initialize(exp, parent) super @name = exp[2].to_s @full_name = get_full_name @calls = Hash.new(0) end def full_name return @full_name if @full_name parent = @parent.is_a?(BlockContext) ? @parent.parent : @parent return @name if !parent "#{parent.full_name}.#{@name}" end def record_call_to(exp) @calls[exp] += 1 end private def get_full_name if @exp[1].is_a?(Sexp) if @exp[1].node_type == :call return "#{@exp[1][2]}.#{@name}" elsif @exp[1].node_type == :const return "#{@exp[1][1]}.#{@name}" end end nil end end end end end
Version data entries
8 entries across 8 versions & 1 rubygems