Class: Jekyll::Archimate::EntityBase

Inherits:
Object
  • Object
show all
Defined in:
lib/jekyll/archimate/archimate_hook.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.



17
18
19
20
# File 'lib/jekyll/archimate/archimate_hook.rb', line 17

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

Instance Attribute Details

#entityObject (readonly)

Returns the value of attribute entity.



14
15
16
# File 'lib/jekyll/archimate/archimate_hook.rb', line 14

def entity
  @entity
end

#modelObject (readonly)

Returns the value of attribute model.



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

def model
  @model
end

Instance Method Details

#attr_hashObject



26
27
28
29
30
31
32
33
# File 'lib/jekyll/archimate/archimate_hook.rb', line 26

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

#to_hObject



22
23
24
# File 'lib/jekyll/archimate/archimate_hook.rb', line 22

def to_h
  Archimate.hash_purge(attr_hash)
end