Class: Lutaml::XMI::KlassDrop
- Inherits:
-
Liquid::Drop
- Object
- Liquid::Drop
- Lutaml::XMI::KlassDrop
- Defined in:
- lib/lutaml/xmi/liquid_drops/klass_drop.rb
Instance Method Summary collapse
- #associations ⇒ Object
- #attributes ⇒ Object
- #constraints ⇒ Object
- #definition ⇒ Object
- #generalization ⇒ Object
- #has_guidance? ⇒ Boolean
-
#initialize(model, guidance = nil) ⇒ KlassDrop
constructor
rubocop:disable Lint/MissingSuper.
- #is_abstract ⇒ Object
- #name ⇒ Object
- #operations ⇒ Object
- #package ⇒ Object
- #stereotype ⇒ Object
- #type ⇒ Object
- #xmi_id ⇒ Object
Constructor Details
#initialize(model, guidance = nil) ⇒ KlassDrop
rubocop:disable Lint/MissingSuper
6 7 8 9 10 11 12 13 14 15 16 17 |
# File 'lib/lutaml/xmi/liquid_drops/klass_drop.rb', line 6 def initialize(model, guidance = nil) # rubocop:disable Lint/MissingSuper @model = model @guidance = guidance if guidance && guidance["classes"].map do |c| c["name"] end.include?(@model[:name]) @klass_guidance = guidance["classes"].find do |klass| klass["name"] == @model[:name] end end end |
Instance Method Details
#associations ⇒ Object
41 42 43 44 45 |
# File 'lib/lutaml/xmi/liquid_drops/klass_drop.rb', line 41 def associations @model[:associations]&.map do |association| ::Lutaml::XMI::AssociationDrop.new(association) end end |
#attributes ⇒ Object
35 36 37 38 39 |
# File 'lib/lutaml/xmi/liquid_drops/klass_drop.rb', line 35 def attributes @model[:attributes]&.map do |attribute| ::Lutaml::XMI::AttributeDrop.new(attribute) end end |
#constraints ⇒ Object
53 54 55 56 57 |
# File 'lib/lutaml/xmi/liquid_drops/klass_drop.rb', line 53 def constraints @model[:constraints]&.map do |constraint| ::Lutaml::XMI::ConstraintDrop.new(constraint) end end |
#definition ⇒ Object
74 75 76 |
# File 'lib/lutaml/xmi/liquid_drops/klass_drop.rb', line 74 def definition @model[:definition] end |
#generalization ⇒ Object
59 60 61 62 63 64 |
# File 'lib/lutaml/xmi/liquid_drops/klass_drop.rb', line 59 def generalization return {} if @model[:generalization].nil? ::Lutaml::XMI::GeneralizationDrop.new(@model[:generalization], @klass_guidance) end |
#has_guidance? ⇒ Boolean
66 67 68 |
# File 'lib/lutaml/xmi/liquid_drops/klass_drop.rb', line 66 def has_guidance? !!@klass_guidance end |
#is_abstract ⇒ Object
70 71 72 |
# File 'lib/lutaml/xmi/liquid_drops/klass_drop.rb', line 70 def is_abstract @model[:is_abstract] end |
#name ⇒ Object
23 24 25 |
# File 'lib/lutaml/xmi/liquid_drops/klass_drop.rb', line 23 def name @model[:name] end |
#operations ⇒ Object
47 48 49 50 51 |
# File 'lib/lutaml/xmi/liquid_drops/klass_drop.rb', line 47 def operations @model[:operations]&.map do |operation| ::Lutaml::XMI::OperationDrop.new(operation) end end |
#package ⇒ Object
27 28 29 |
# File 'lib/lutaml/xmi/liquid_drops/klass_drop.rb', line 27 def package ::Lutaml::XMI::PackageDrop.new(@model[:package], @guidance) end |
#stereotype ⇒ Object
78 79 80 |
# File 'lib/lutaml/xmi/liquid_drops/klass_drop.rb', line 78 def stereotype @model[:stereotype] end |
#type ⇒ Object
31 32 33 |
# File 'lib/lutaml/xmi/liquid_drops/klass_drop.rb', line 31 def type @model[:type] end |
#xmi_id ⇒ Object
19 20 21 |
# File 'lib/lutaml/xmi/liquid_drops/klass_drop.rb', line 19 def xmi_id @model[:xmi_id] end |