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
- #absolute_path ⇒ Object
- #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 |
# 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 @klass_guidance = guidance["classes"].find do |klass| klass["name"] == name || klass["name"] == absolute_path end end end |
Instance Method Details
#absolute_path ⇒ Object
25 26 27 |
# File 'lib/lutaml/xmi/liquid_drops/klass_drop.rb', line 25 def absolute_path "#{@model[:absolute_path]}::#{name}" end |
#associations ⇒ Object
43 44 45 46 47 |
# File 'lib/lutaml/xmi/liquid_drops/klass_drop.rb', line 43 def associations @model[:associations]&.map do |association| ::Lutaml::XMI::AssociationDrop.new(association) end end |
#attributes ⇒ Object
37 38 39 40 41 |
# File 'lib/lutaml/xmi/liquid_drops/klass_drop.rb', line 37 def attributes @model[:attributes]&.map do |attribute| ::Lutaml::XMI::AttributeDrop.new(attribute) end end |
#constraints ⇒ Object
55 56 57 58 59 |
# File 'lib/lutaml/xmi/liquid_drops/klass_drop.rb', line 55 def constraints @model[:constraints]&.map do |constraint| ::Lutaml::XMI::ConstraintDrop.new(constraint) end end |
#definition ⇒ Object
76 77 78 |
# File 'lib/lutaml/xmi/liquid_drops/klass_drop.rb', line 76 def definition @model[:definition] end |
#generalization ⇒ Object
61 62 63 64 65 66 |
# File 'lib/lutaml/xmi/liquid_drops/klass_drop.rb', line 61 def generalization return {} if @model[:generalization].nil? ::Lutaml::XMI::GeneralizationDrop.new(@model[:generalization], @klass_guidance) end |
#has_guidance? ⇒ Boolean
68 69 70 |
# File 'lib/lutaml/xmi/liquid_drops/klass_drop.rb', line 68 def has_guidance? !!@klass_guidance end |
#is_abstract ⇒ Object
72 73 74 |
# File 'lib/lutaml/xmi/liquid_drops/klass_drop.rb', line 72 def is_abstract @model[:is_abstract] end |
#name ⇒ Object
21 22 23 |
# File 'lib/lutaml/xmi/liquid_drops/klass_drop.rb', line 21 def name @model[:name] end |
#operations ⇒ Object
49 50 51 52 53 |
# File 'lib/lutaml/xmi/liquid_drops/klass_drop.rb', line 49 def operations @model[:operations]&.map do |operation| ::Lutaml::XMI::OperationDrop.new(operation) end end |
#package ⇒ Object
29 30 31 |
# File 'lib/lutaml/xmi/liquid_drops/klass_drop.rb', line 29 def package ::Lutaml::XMI::PackageDrop.new(@model[:package], @guidance) end |
#stereotype ⇒ Object
80 81 82 |
# File 'lib/lutaml/xmi/liquid_drops/klass_drop.rb', line 80 def stereotype @model[:stereotype] end |
#type ⇒ Object
33 34 35 |
# File 'lib/lutaml/xmi/liquid_drops/klass_drop.rb', line 33 def type @model[:type] end |
#xmi_id ⇒ Object
17 18 19 |
# File 'lib/lutaml/xmi/liquid_drops/klass_drop.rb', line 17 def xmi_id @model[:xmi_id] end |