Class: Archimate::Lint::DuplicateEntities
- Inherits:
-
Object
- Object
- Archimate::Lint::DuplicateEntities
- Defined in:
- lib/archimate/lint/duplicate_entities.rb
Instance Attribute Summary collapse
-
#word_count ⇒ Object
readonly
Returns the value of attribute word_count.
Instance Method Summary collapse
- #count ⇒ Object
- #each ⇒ Object
- #empty? ⇒ Boolean
-
#initialize(model) ⇒ DuplicateEntities
constructor
TODO: Add option to permit additional project specific stop words TODO: Do relationships after elements are merged.
Constructor Details
#initialize(model) ⇒ DuplicateEntities
TODO: Add option to permit additional project specific stop words TODO: Do relationships after elements are merged
48 49 50 51 52 53 54 55 |
# File 'lib/archimate/lint/duplicate_entities.rb', line 48 def initialize(model) @model = model @dupes = nil @count = nil @word_count = {} @ignored_entity_types = %w[AndJunction OrJunction] dupe_list end |
Instance Attribute Details
#word_count ⇒ Object (readonly)
Returns the value of attribute word_count.
45 46 47 |
# File 'lib/archimate/lint/duplicate_entities.rb', line 45 def word_count @word_count end |
Instance Method Details
#count ⇒ Object
57 58 59 |
# File 'lib/archimate/lint/duplicate_entities.rb', line 57 def count @dupes.reduce(0) { |total, (_tag, ary)| total + ary.size } end |
#each ⇒ Object
65 66 67 68 69 70 71 |
# File 'lib/archimate/lint/duplicate_entities.rb', line 65 def each @dupes.keys.sort.each do |name| ary = @dupes[name] element_type = ary.first.type yield(element_type, name, ary) end end |
#empty? ⇒ Boolean
61 62 63 |
# File 'lib/archimate/lint/duplicate_entities.rb', line 61 def empty? count.zero? end |