Sha256: 0ad44f1c3d041807f0fe2e8f4c6a8567ffe873dce7007adc2e9b753aec91d0aa
Contents?: true
Size: 1.1 KB
Versions: 2
Compression:
Stored size: 1.1 KB
Contents
require 'set' module Reek module Core # # A set of items that can be "masked" or "visible". If an item is added # more than once, only the "visible" copy is retained. # class MaskingCollection def initialize @visible_items = SortedSet.new @masked_items = SortedSet.new end def all_items all = SortedSet.new(@visible_items) all.merge(@masked_items) all.to_a end def all_active_items @visible_items end def found_smell(item) @visible_items.add(item) @masked_items.delete(item) if @masked_items.include?(item) end def found_masked_smell(item) @masked_items.add(item) unless @visible_items.include?(item) end def num_visible_items @visible_items.length end def num_masked_items @masked_items.length end def each_item(&blk) all = SortedSet.new(@visible_items) all.merge(@masked_items) all.each(&blk) end def each_visible_item(&blk) @visible_items.each(&blk) end end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
reek-1.2.7.1 | lib/reek/core/masking_collection.rb |
reek-1.2.7 | lib/reek/core/masking_collection.rb |