Class: Lutaml::XMI::PackageDrop
Instance Method Summary
collapse
#get_guidance, included, #set_xmi_model
Constructor Details
#initialize(model, guidance = nil, options = {}) ⇒ PackageDrop
rubocop:disable Lint/MissingSuper,Metrics/AbcSize,Metrics/CyclomaticComplexity,Metrics/MethodLength,Metrics/PerceivedComplexity
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
|
# File 'lib/lutaml/xmi/liquid_drops/package_drop.rb', line 8
def initialize(model, guidance = nil, options = {}) @model = model
@guidance = guidance
@options = options
@xmi_root_model = options[:xmi_root_model]
@xmi_cache = options[:xmi_cache]
@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
42
43
44
|
# File 'lib/lutaml/xmi/liquid_drops/package_drop.rb', line 42
def absolute_path
"#{@options[:absolute_path]}::#{name}"
end
|
#children_packages ⇒ Object
101
102
103
|
# File 'lib/lutaml/xmi/liquid_drops/package_drop.rb', line 101
def children_packages
@children_packages
end
|
#data_types ⇒ Object
71
72
73
74
75
|
# File 'lib/lutaml/xmi/liquid_drops/package_drop.rb', line 71
def data_types
@all_data_type_elements.map do |data_type|
::Lutaml::XMI::DataTypeDrop.new(data_type, @options)
end
end
|
#definition ⇒ Object
105
106
107
|
# File 'lib/lutaml/xmi/liquid_drops/package_drop.rb', line 105
def definition
doc_node_attribute_value(@model.id, "documentation")
end
|
#diagrams ⇒ Object
77
78
79
80
81
82
83
84
85
|
# File 'lib/lutaml/xmi/liquid_drops/package_drop.rb', line 77
def diagrams
diagrams = @xmi_root_model.extension.diagrams.diagram.select do |d|
d.model.package == @model.id
end
diagrams.map do |diagram|
::Lutaml::XMI::DiagramDrop.new(diagram, @options)
end
end
|
#enums ⇒ Object
61
62
63
64
65
66
67
68
69
|
# File 'lib/lutaml/xmi/liquid_drops/package_drop.rb', line 61
def enums
enums = @model.packaged_element.select do |e|
e.type?("uml:Enumeration")
end
enums.map do |enum|
::Lutaml::XMI::EnumDrop.new(enum, @options)
end
end
|
#klasses ⇒ Object
Also known as:
classes
rubocop:disable Metrics/MethodLength
46
47
48
49
50
51
52
53
54
55
56
57
58
|
# File 'lib/lutaml/xmi/liquid_drops/package_drop.rb', line 46
def klasses @klasses.map do |klass|
::Lutaml::XMI::KlassDrop.new(
klass,
@guidance,
@options.merge(
{
absolute_path: "#{@options[:absolute_path]}::#{name}",
},
),
)
end
end
|
#name ⇒ Object
38
39
40
|
# File 'lib/lutaml/xmi/liquid_drops/package_drop.rb', line 38
def name
get_package_name(@model)
end
|
#packages ⇒ Object
rubocop:disable Metrics/MethodLength
87
88
89
90
91
92
93
94
95
96
97
98
99
|
# File 'lib/lutaml/xmi/liquid_drops/package_drop.rb', line 87
def packages @packages.map do |package|
::Lutaml::XMI::PackageDrop.new(
package,
@guidance,
@options.merge(
{
absolute_path: "#{@options[:absolute_path]}::#{name}",
},
),
)
end
end
|
#stereotype ⇒ Object
109
110
111
|
# File 'lib/lutaml/xmi/liquid_drops/package_drop.rb', line 109
def stereotype
doc_node_attribute_value(@model.id, "stereotype")
end
|
#xmi_id ⇒ Object
34
35
36
|
# File 'lib/lutaml/xmi/liquid_drops/package_drop.rb', line 34
def xmi_id
@model.id
end
|