Sha256: a190d9134b18049bceab3cf1fdc0bd959aa71431eca7dccf11cc820696a25a2b
Contents?: true
Size: 1.14 KB
Versions: 5
Compression:
Stored size: 1.14 KB
Contents
require 'simplabs/excellent/parsing/cyclomatic_complexity_measure' require 'simplabs/excellent/parsing/abc_measure' require 'simplabs/excellent/parsing/flog_measure' module Simplabs module Excellent module Parsing class MethodContext < SexpContext #:nodoc: include CyclomaticComplexityMeasure include AbcMeasure include FlogMeasure attr_reader :parameters attr_reader :calls attr_reader :line_count def initialize(exp, parent) super @parameters = [] @name = exp[1].to_s @parent.methods << self if @parent && (@parent.is_a?(ClassContext) || @parent.is_a?(ModuleContext)) @calls = Hash.new(0) @line_count = count_lines end def has_parameter?(parameter) @parameters.include?(parameter) end def full_name parent = @parent.is_a?(BlockContext) ? @parent.parent : @parent return @name if parent.blank? "#{parent.full_name}##{@name}" end def record_call_to(context) @calls[context] += 1 end end end end end
Version data entries
5 entries across 5 versions & 2 rubygems