Class: Lutaml::Xmi::LiquidDrops::EnumDrop

Inherits:
Liquid::Drop
  • Object
show all
Includes:
Parsers::XmiBase
Defined in:
lib/lutaml/xmi/liquid_drops/enum_drop.rb

Instance Method Summary collapse

Methods included from Parsers::XmiBase

included, #set_xmi_model

Constructor Details

#initialize(model, options = {}) ⇒ EnumDrop

rubocop:disable Lint/MissingSuper



9
10
11
12
13
14
15
16
17
18
# File 'lib/lutaml/xmi/liquid_drops/enum_drop.rb', line 9

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

  @owned_literals = model&.owned_literal&.select do |owned_literal|
    owned_literal.type? "uml:EnumerationLiteral"
  end
end

Instance Method Details

#definitionObject



35
36
37
# File 'lib/lutaml/xmi/liquid_drops/enum_drop.rb', line 35

def definition
  doc_node_attribute_value(@model.id, "documentation")
end

#nameObject



24
25
26
# File 'lib/lutaml/xmi/liquid_drops/enum_drop.rb', line 24

def name
  @model.name
end

#stereotypeObject



39
40
41
# File 'lib/lutaml/xmi/liquid_drops/enum_drop.rb', line 39

def stereotype
  doc_node_attribute_value(@model.id, "stereotype")
end

#subtype_ofObject



51
52
53
# File 'lib/lutaml/xmi/liquid_drops/enum_drop.rb', line 51

def subtype_of
  find_subtype_of_from_owned_attribute_type(@model.id)
end

#upper_packaged_elementObject

Returns name of the upper packaged element.

Returns:

  • name of the upper packaged element



44
45
46
47
48
49
# File 'lib/lutaml/xmi/liquid_drops/enum_drop.rb', line 44

def upper_packaged_element
  if @options[:with_gen]
    e = find_upper_level_packaged_element(@model.id)
    e&.name
  end
end

#valuesObject



28
29
30
31
32
33
# File 'lib/lutaml/xmi/liquid_drops/enum_drop.rb', line 28

def values
  @owned_literals.map do |owned_literal|
    ::Lutaml::Xmi::LiquidDrops::EnumOwnedLiteralDrop.new(owned_literal,
                                                         @options)
  end
end

#xmi_idObject



20
21
22
# File 'lib/lutaml/xmi/liquid_drops/enum_drop.rb', line 20

def xmi_id
  @model.id
end