Class: Jekyll::Archimate::Folder

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



88
89
90
# File 'lib/jekyll/archimate/archimate_hook.rb', line 88

def initialize(folder)
  @folder = folder
end

Instance Attribute Details

#folderObject (readonly)

Returns the value of attribute folder.



86
87
88
# File 'lib/jekyll/archimate/archimate_hook.rb', line 86

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.



94
95
96
# File 'lib/jekyll/archimate/archimate_hook.rb', line 94

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

#to_hObject



98
99
100
101
102
103
104
105
# File 'lib/jekyll/archimate/archimate_hook.rb', line 98

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