Class: Lutaml::Uml::Association

Inherits:
TopElement show all
Includes:
HasMembers
Defined in:
lib/lutaml/uml/association.rb

Instance Attribute Summary collapse

Attributes inherited from TopElement

#comments, #definition, #href, #keyword, #name, #namespace, #stereotype, #visibility, #xmi_id, #xmi_uuid

Instance Method Summary collapse

Methods inherited from TopElement

#full_name, #initialize

Methods included from HasAttributes

#update_attributes

Constructor Details

This class inherits a constructor from Lutaml::Uml::TopElement

Instance Attribute Details

#actionObject

Returns the value of attribute action.



8
9
10
# File 'lib/lutaml/uml/association.rb', line 8

def action
  @action
end

#member_endObject

Returns the value of attribute member_end.



8
9
10
# File 'lib/lutaml/uml/association.rb', line 8

def member_end
  @member_end
end

#member_end_attribute_nameObject

Returns the value of attribute member_end_attribute_name.



8
9
10
# File 'lib/lutaml/uml/association.rb', line 8

def member_end_attribute_name
  @member_end_attribute_name
end

#member_end_cardinalityObject

Returns the value of attribute member_end_cardinality.



8
9
10
# File 'lib/lutaml/uml/association.rb', line 8

def member_end_cardinality
  @member_end_cardinality
end

#member_end_typeObject

Returns the value of attribute member_end_type.



8
9
10
# File 'lib/lutaml/uml/association.rb', line 8

def member_end_type
  @member_end_type
end

#member_end_xmi_idObject

Returns the value of attribute member_end_xmi_id.



8
9
10
# File 'lib/lutaml/uml/association.rb', line 8

def member_end_xmi_id
  @member_end_xmi_id
end

#owner_endObject

Returns the value of attribute owner_end.



8
9
10
# File 'lib/lutaml/uml/association.rb', line 8

def owner_end
  @owner_end
end

#owner_end_attribute_nameObject

Returns the value of attribute owner_end_attribute_name.



8
9
10
# File 'lib/lutaml/uml/association.rb', line 8

def owner_end_attribute_name
  @owner_end_attribute_name
end

#owner_end_cardinalityObject

Returns the value of attribute owner_end_cardinality.



8
9
10
# File 'lib/lutaml/uml/association.rb', line 8

def owner_end_cardinality
  @owner_end_cardinality
end

#owner_end_typeObject

Returns the value of attribute owner_end_type.



8
9
10
# File 'lib/lutaml/uml/association.rb', line 8

def owner_end_type
  @owner_end_type
end

#owner_end_xmi_idObject

Returns the value of attribute owner_end_xmi_id.



8
9
10
# File 'lib/lutaml/uml/association.rb', line 8

def owner_end_xmi_id
  @owner_end_xmi_id
end

#staticObject

Returns the value of attribute static.



8
9
10
# File 'lib/lutaml/uml/association.rb', line 8

def static
  @static
end

Instance Method Details

#members=(value) ⇒ Object

TODO: move to Parslet::Transform



22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
# File 'lib/lutaml/uml/association.rb', line 22

def members=(value)
  value.group_by { |member| member.keys.first }
    .each do |(type, group)|
      if %w[owner_end member_end].include?(type)
        group.each do |member|
          member.each_pair do |key, member_value|
            public_send(:"#{associtaion_type(key)}=", member_value)
          end
        end
        next
      end
      attribute_value = group.map(&:values).flatten
      if attribute_value.length == 1 && !attribute_value.first.is_a?(Hash)
        next public_send(:"#{associtaion_type(type)}=",
                         attribute_value.first)
      end

      public_send(:"#{associtaion_type(type)}=", attribute_value)
    end
end