Sha256: a89d9201089f4e2578391ad9a99670e3665fb03c4314f1db92d73f5dea0e5fd7
Contents?: true
Size: 599 Bytes
Versions: 14
Compression:
Stored size: 599 Bytes
Contents
module Reek module Core # # Manages and counts the references out of a method to other objects. # class ObjectRefs # :nodoc: def initialize @refs = Hash.new(0) end def record_reference_to(exp) @refs[exp] += 1 end def references_to(exp) @refs[exp] end def max_refs @refs.values.max or 0 end def max_keys max = max_refs @refs.reject {|key,val| val != max} end def self_is_max? max_keys.length == 0 || @refs[:self] == max_refs end end end end
Version data entries
14 entries across 14 versions & 1 rubygems