Class: Lutaml::Xmi::LiquidDrops::PackageDrop
- Inherits:
-
Liquid::Drop
- Object
- Liquid::Drop
- Lutaml::Xmi::LiquidDrops::PackageDrop
show all
- Includes:
- Parsers::XmiBase
- Defined in:
- lib/lutaml/xmi/liquid_drops/package_drop.rb
Instance Method Summary
collapse
included, #set_xmi_model, #xmi_index
Constructor Details
#initialize(model, guidance = nil, options = {}) ⇒ PackageDrop
rubocop:disable Lint/MissingSuper,Metrics/AbcSize,Metrics/CyclomaticComplexity,Metrics/MethodLength,Metrics/PerceivedComplexity
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
|
# File 'lib/lutaml/xmi/liquid_drops/package_drop.rb', line 9
def initialize(model, guidance = nil, options = {}) @model = model
@guidance = guidance
@options = options
@xmi_root_model = options[:xmi_root_model]
@id_name_mapping = options[:id_name_mapping]
@packages = model.packaged_element.select do |e|
e.type?("uml:Package")
end
@klasses = model.packaged_element.select do |e|
e.type?("uml:Class") || e.type?("uml:AssociationClass") ||
e.type?("uml:Interface")
end
@all_data_type_elements = []
select_all_packaged_elements(@all_data_type_elements, model,
"uml:DataType")
@children_packages ||= packages.map do |pkg|
[pkg, pkg.packages, pkg.packages.map(&:children_packages)]
end.flatten.uniq
end
|
Instance Method Details
#absolute_path ⇒ Object
43
44
45
46
47
48
49
50
51
52
53
54
55
|
# File 'lib/lutaml/xmi/liquid_drops/package_drop.rb', line 43
def absolute_path
absolute_path_arr = [@model.name]
e = find_upper_level_packaged_element(@model.id)
absolute_path_arr << e.name if e
while e
e = find_upper_level_packaged_element(e.id)
absolute_path_arr << e.name if e
end
absolute_path_arr << "::#{@xmi_root_model.model.name}"
absolute_path_arr.reverse.join("::")
end
|
#children_packages ⇒ Object
112
113
114
|
# File 'lib/lutaml/xmi/liquid_drops/package_drop.rb', line 112
def children_packages
@children_packages
end
|
#data_types ⇒ Object
82
83
84
85
86
|
# File 'lib/lutaml/xmi/liquid_drops/package_drop.rb', line 82
def data_types
@all_data_type_elements.map do |data_type|
::Lutaml::Xmi::LiquidDrops::DataTypeDrop.new(data_type, @options)
end
end
|
#definition ⇒ Object
116
117
118
|
# File 'lib/lutaml/xmi/liquid_drops/package_drop.rb', line 116
def definition
doc_node_attribute_value(@model.id, "documentation")
end
|
#diagrams ⇒ Object
88
89
90
91
92
93
94
95
96
|
# File 'lib/lutaml/xmi/liquid_drops/package_drop.rb', line 88
def diagrams
diagrams = @xmi_root_model.extension.diagrams.diagram.select do |d|
d.model.package == @model.id
end
diagrams.map do |diagram|
::Lutaml::Xmi::LiquidDrops::DiagramDrop.new(diagram, @options)
end
end
|
#enums ⇒ Object
72
73
74
75
76
77
78
79
80
|
# File 'lib/lutaml/xmi/liquid_drops/package_drop.rb', line 72
def enums
enums = @model.packaged_element.select do |e|
e.type?("uml:Enumeration")
end
enums.map do |enum|
::Lutaml::Xmi::LiquidDrops::EnumDrop.new(enum, @options)
end
end
|
#klasses ⇒ Object
Also known as:
classes
rubocop:disable Metrics/MethodLength
57
58
59
60
61
62
63
64
65
66
67
68
69
|
# File 'lib/lutaml/xmi/liquid_drops/package_drop.rb', line 57
def klasses @klasses.map do |klass|
::Lutaml::Xmi::LiquidDrops::KlassDrop.new(
klass,
@guidance,
@options.merge(
{
absolute_path: "#{@options[:absolute_path]}::#{name}",
},
),
)
end
end
|
#name ⇒ Object
39
40
41
|
# File 'lib/lutaml/xmi/liquid_drops/package_drop.rb', line 39
def name
get_package_name(@model)
end
|
#packages ⇒ Object
rubocop:disable Metrics/MethodLength
98
99
100
101
102
103
104
105
106
107
108
109
110
|
# File 'lib/lutaml/xmi/liquid_drops/package_drop.rb', line 98
def packages @packages.map do |package|
::Lutaml::Xmi::LiquidDrops::PackageDrop.new(
package,
@guidance,
@options.merge(
{
absolute_path: "#{@options[:absolute_path]}::#{name}",
},
),
)
end
end
|
#stereotype ⇒ Object
120
121
122
|
# File 'lib/lutaml/xmi/liquid_drops/package_drop.rb', line 120
def stereotype
doc_node_attribute_value(@model.id, "stereotype")
end
|
#xmi_id ⇒ Object
35
36
37
|
# File 'lib/lutaml/xmi/liquid_drops/package_drop.rb', line 35
def xmi_id
@model.id
end
|