Class: Jekyll::Archimate::EntityBase

Inherits:
Object
  • Object
show all
Defined in:
lib/jekyll/archimate/entity_base.rb

Overview

Base class for ArchiMate Entities: Model, Diagram, Element, Relationship

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(entity, model: nil) ⇒ EntityBase

Returns a new instance of EntityBase.



10
11
12
13
# File 'lib/jekyll/archimate/entity_base.rb', line 10

def initialize(entity, model: nil)
  @entity = entity
  @model = model
end

Instance Attribute Details

#entityObject (readonly)

Returns the value of attribute entity.



7
8
9
# File 'lib/jekyll/archimate/entity_base.rb', line 7

def entity
  @entity
end

#modelObject (readonly)

Returns the value of attribute model.



8
9
10
# File 'lib/jekyll/archimate/entity_base.rb', line 8

def model
  @model
end

Instance Method Details

#attr_hashObject



19
20
21
22
23
24
25
26
# File 'lib/jekyll/archimate/entity_base.rb', line 19

def attr_hash
  {
    id: entity.id,
    name: entity.name,
    documentation: entity.documentation&.to_h,
    properties: entity.properties.map(&:to_h)
  }
end

#to_hObject



15
16
17
# File 'lib/jekyll/archimate/entity_base.rb', line 15

def to_h
  Archimate.hash_purge(attr_hash)
end