Sha256: 45317fcf72c7e72b6c7b70cae2b450d3fec377b8103e65c833b166d558fd4171
Contents?: true
Size: 1.14 KB
Versions: 8
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 "#{parent.full_name}##{@name}" end def record_call_to(context) @calls[context] += 1 end end end end end
Version data entries
8 entries across 8 versions & 1 rubygems