Class: Archimate::Export::JsonlEdge

Inherits:
Object
  • Object
show all
Defined in:
lib/archimate/export/jsonl.rb

Constant Summary collapse

WEIGHTS =
{
  'GroupingRelationship' => 0,
  'JunctionRelationship' => 0,
  'AssociationRelationship' => 0,
  'SpecialisationRelationship' => 1,
  'FlowRelationship' => 2,
  'TriggeringRelationship' => 3,
  'InfluenceRelationship' => 4,
  'AccessRelationship' => 5,
  'UsedByRelationship' => 6,
  'RealisationRelationship' => 7,
  'AssignmentRelationship' => 8,
  'AggregationRelationship' => 9,
  'CompositionRelationship' => 10
}

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(relationship) ⇒ JsonlEdge

Returns a new instance of JsonlEdge.



109
110
111
# File 'lib/archimate/export/jsonl.rb', line 109

def initialize(relationship)
  @relationship = relationship
end

Instance Attribute Details

#relationshipObject (readonly)

Returns the value of attribute relationship.



107
108
109
# File 'lib/archimate/export/jsonl.rb', line 107

def relationship
  @relationship
end

Instance Method Details

#to_jsonlObject



113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
# File 'lib/archimate/export/jsonl.rb', line 113

def to_jsonl
  Export.clean_json(
    {
      _key: relationship.id,
      _from: relationship.source,
      _to: relationship.target,
      name: relationship.name&.to_s,
      type: relationship.type,
      accessType: relationship.access_type,
      documentation: relationship.documentation&.to_s,
      properties: PropertiesHash.new(relationship.properties).to_h,
      weight: weight
    }
  )
end