Class: Archimate::Lint::DuplicateEntities

Inherits:
Object
  • Object
show all
Defined in:
lib/archimate/lint/duplicate_entities.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

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_countObject (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

#countObject



57
58
59
# File 'lib/archimate/lint/duplicate_entities.rb', line 57

def count
  @dupes.reduce(0) { |total, (_tag, ary)| total + ary.size }
end

#eachObject



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

Returns:

  • (Boolean)


61
62
63
# File 'lib/archimate/lint/duplicate_entities.rb', line 61

def empty?
  count.zero?
end