Class: Lutaml::Xmi::LiquidDrops::PackageDrop

Inherits:
Liquid::Drop
  • Object
show all
Defined in:
lib/lutaml/xmi/liquid_drops/package_drop.rb

Instance Method Summary collapse

Constructor Details

#initialize(model, guidance = nil, options = {}) ⇒ PackageDrop

rubocop:disable Lint/MissingSuper



7
8
9
10
11
12
13
# File 'lib/lutaml/xmi/liquid_drops/package_drop.rb', line 7

def initialize(model, guidance = nil, options = {}) # rubocop:disable Lint/MissingSuper
  @model = model
  @guidance = guidance
  @options = options
  @lookup = options[:lookup]
  @xmi_root_model = options[:xmi_root_model]
end

Instance Method Details

#absolute_pathObject



23
24
25
26
27
28
29
30
31
32
33
34
35
# File 'lib/lutaml/xmi/liquid_drops/package_drop.rb', line 23

def absolute_path
  absolute_path_arr = [@model.name]
  e = @lookup.find_upper_level_packaged_element(@model.xmi_id)
  absolute_path_arr << e.name if e

  while e
    e = @lookup.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_packagesObject



84
85
86
# File 'lib/lutaml/xmi/liquid_drops/package_drop.rb', line 84

def children_packages
  @model.children_packages
end

#data_typesObject



58
59
60
61
62
# File 'lib/lutaml/xmi/liquid_drops/package_drop.rb', line 58

def data_types
  @model.data_types.map do |data_type|
    ::Lutaml::Xmi::LiquidDrops::DataTypeDrop.new(data_type, @options)
  end
end

#definitionObject



88
89
90
# File 'lib/lutaml/xmi/liquid_drops/package_drop.rb', line 88

def definition
  @model.definition
end

#diagramsObject



64
65
66
67
68
# File 'lib/lutaml/xmi/liquid_drops/package_drop.rb', line 64

def diagrams
  @model.diagrams.map do |diagram|
    ::Lutaml::Xmi::LiquidDrops::DiagramDrop.new(diagram, @options)
  end
end

#enumsObject



52
53
54
55
56
# File 'lib/lutaml/xmi/liquid_drops/package_drop.rb', line 52

def enums
  @model.enums.map do |enum|
    ::Lutaml::Xmi::LiquidDrops::EnumDrop.new(enum, @options)
  end
end

#klassesObject Also known as: classes



37
38
39
40
41
42
43
44
45
46
47
48
49
# File 'lib/lutaml/xmi/liquid_drops/package_drop.rb', line 37

def klasses
  @model.classes.map do |klass|
    ::Lutaml::Xmi::LiquidDrops::KlassDrop.new(
      klass,
      @guidance,
      @options.merge(
        {
          absolute_path: "#{@options[:absolute_path]}::#{name}",
        },
      ),
    )
  end
end

#nameObject



19
20
21
# File 'lib/lutaml/xmi/liquid_drops/package_drop.rb', line 19

def name
  @model.name
end

#packagesObject



70
71
72
73
74
75
76
77
78
79
80
81
82
# File 'lib/lutaml/xmi/liquid_drops/package_drop.rb', line 70

def packages
  @model.packages.map do |package|
    ::Lutaml::Xmi::LiquidDrops::PackageDrop.new(
      package,
      @guidance,
      @options.merge(
        {
          absolute_path: "#{@options[:absolute_path]}::#{name}",
        },
      ),
    )
  end
end

#stereotypeObject



92
93
94
# File 'lib/lutaml/xmi/liquid_drops/package_drop.rb', line 92

def stereotype
  @model.stereotype&.first
end

#xmi_idObject



15
16
17
# File 'lib/lutaml/xmi/liquid_drops/package_drop.rb', line 15

def xmi_id
  @model.xmi_id
end