Sha256: 09a7839042d0be29cdc26be9cbc29dd023ab7769a40f33469ca84ee2924eaaf0
Contents?: true
Size: 1.17 KB
Versions: 12
Compression:
Stored size: 1.17 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.blank? "#{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
12 entries across 12 versions & 2 rubygems