Class: Jekyll::Archimate::Folder

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

Overview

Represents an ArchiMate Organizing Folder

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(folder) ⇒ Folder

Returns a new instance of Folder.



9
10
11
# File 'lib/jekyll/archimate/folder.rb', line 9

def initialize(folder)
  @folder = folder
end

Instance Attribute Details

#folderObject (readonly)

Returns the value of attribute folder.



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

def folder
  @folder
end

Instance Method Details

#itemsObject

This item check is necessary because some models seem to contain an item that is a string rather than an element of some sort.



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

def items
  folder.items.map { |item| item.is_a?(String) ? item : item.id }
end

#to_hObject



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

def to_h
  Archimate.hash_purge(
    id: folder.id,
    name: folder.name.to_s,
    folders: folder.organizations.map { |child| Folder.new(child).to_h },
    diagrams: items
  )
end