Class: Lutaml::Xmi::LiquidDrops::AttributeDrop

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

Instance Method Summary collapse

Constructor Details

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

rubocop:disable Lint/MissingSuper



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

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

Instance Method Details

#associationObject



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

def association
  if @options[:with_assoc] && @model.association
    @model.association
  end
end

#association_connectorObject



51
52
53
54
55
56
57
58
# File 'lib/lutaml/xmi/liquid_drops/attribute_drop.rb', line 51

def association_connector
  return unless @model.association

  connector = @lookup.fetch_connector(@model.association)
  if connector
    ::Lutaml::Xmi::LiquidDrops::ConnectorDrop.new(connector, @options)
  end
end

#cardinalityObject



33
34
35
# File 'lib/lutaml/xmi/liquid_drops/attribute_drop.rb', line 33

def cardinality
  ::Lutaml::Xmi::LiquidDrops::CardinalityDrop.new(@model.cardinality)
end

#definitionObject



37
38
39
40
41
42
43
# File 'lib/lutaml/xmi/liquid_drops/attribute_drop.rb', line 37

def definition
  if @options[:with_assoc] && @model.association
    @lookup.loopup_assoc_def(@model.association)
  else
    @model.definition
  end
end

#idObject



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

def id
  @model.id
end

#is_derivedObject

rubocop:disable Naming/PredicateName,Naming/PredicatePrefix



29
30
31
# File 'lib/lutaml/xmi/liquid_drops/attribute_drop.rb', line 29

def is_derived # rubocop:disable Naming/PredicateName,Naming/PredicatePrefix
  @model.is_derived
end

#nameObject



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

def name
  @model.name
end

#stereotypeObject



66
67
68
# File 'lib/lutaml/xmi/liquid_drops/attribute_drop.rb', line 66

def stereotype
  @lookup.doc_node_attribute_value(@model.xmi_id, "stereotype")
end

#typeObject



21
22
23
# File 'lib/lutaml/xmi/liquid_drops/attribute_drop.rb', line 21

def type
  @model.type
end

#type_nsObject



60
61
62
63
64
# File 'lib/lutaml/xmi/liquid_drops/attribute_drop.rb', line 60

def type_ns
  if @options[:with_assoc] && @model.association
    @model.type_ns
  end
end

#xmi_idObject



25
26
27
# File 'lib/lutaml/xmi/liquid_drops/attribute_drop.rb', line 25

def xmi_id
  @model.xmi_id
end