Class: Ea::Sources::Xmi::StereotypeBuilder
- Inherits:
-
Object
- Object
- Ea::Sources::Xmi::StereotypeBuilder
- Defined in:
- lib/ea/sources/xmi/stereotype_builder.rb
Overview
Extracts per-element stereotype applications from EA's
<xmi:Extension>/<elements> block. EA stores stereotype
info in <element xmi:idref="EAID_...">/<properties stereotype="X"/>. The uml:Model packaged elements carry
type info but not stereotypes.
Returns a Hash=> Array
Instance Attribute Summary collapse
-
#root ⇒ Object
readonly
Returns the value of attribute root.
Instance Method Summary collapse
- #grouped_by_element ⇒ Object
-
#initialize(root) ⇒ StereotypeBuilder
constructor
A new instance of StereotypeBuilder.
Constructor Details
#initialize(root) ⇒ StereotypeBuilder
Returns a new instance of StereotypeBuilder.
17 18 19 |
# File 'lib/ea/sources/xmi/stereotype_builder.rb', line 17 def initialize(root) @root = root end |
Instance Attribute Details
#root ⇒ Object (readonly)
Returns the value of attribute root.
15 16 17 |
# File 'lib/ea/sources/xmi/stereotype_builder.rb', line 15 def root @root end |
Instance Method Details
#grouped_by_element ⇒ Object
21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 |
# File 'lib/ea/sources/xmi/stereotype_builder.rb', line 21 def grouped_by_element @grouped ||= begin elements = root.extension&.elements return {} unless elements elements.element.each_with_object({}) do |ext_element, acc| id = ext_element.idref next unless id stereotypes = stereotypes_for(ext_element) next if stereotypes.empty? acc[id] = stereotypes end end end |