Sha256: 4618a2f8c80de0e8a2538f23160fdcf17f552acb4a0fb31882e6deee156aed02
Contents?: true
Size: 602 Bytes
Versions: 18
Compression:
Stored size: 602 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 || 0 end def max_keys max = max_refs @refs.select { |_key, val| val == max } end def self_is_max? max_keys.length == 0 || @refs[:self] == max_refs end end end end
Version data entries
18 entries across 18 versions & 1 rubygems