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

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

Instance Method Summary collapse

Constructor Details

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

rubocop:disable Lint/MissingSuper



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

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

Instance Method Details

#definitionObject



27
28
29
# File 'lib/lutaml/xmi/liquid_drops/enum_drop.rb', line 27

def definition
  @model.definition
end

#nameObject



17
18
19
# File 'lib/lutaml/xmi/liquid_drops/enum_drop.rb', line 17

def name
  @model.name
end

#stereotypeObject



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

def stereotype
  @model.stereotype&.first
end

#subtype_ofObject



43
44
45
# File 'lib/lutaml/xmi/liquid_drops/enum_drop.rb', line 43

def subtype_of
  @lookup.find_subtype_of_from_owned_attribute_type(@model.xmi_id)
end

#upper_packaged_elementObject

Returns name of the upper packaged element.

Returns:

  • name of the upper packaged element



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

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

#valuesObject



21
22
23
24
25
# File 'lib/lutaml/xmi/liquid_drops/enum_drop.rb', line 21

def values
  @model.values.map do |value|
    ::Lutaml::Xmi::LiquidDrops::EnumOwnedLiteralDrop.new(value)
  end
end

#xmi_idObject



13
14
15
# File 'lib/lutaml/xmi/liquid_drops/enum_drop.rb', line 13

def xmi_id
  @model.xmi_id
end