Class: Vaulty::VaultTree

Inherits:
Object
  • Object
show all
Defined in:
lib/vaulty/vault_tree.rb

Defined Under Namespace

Classes: Folder, Value

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(catacomb:) ⇒ VaultTree

Returns a new instance of VaultTree.



25
26
27
# File 'lib/vaulty/vault_tree.rb', line 25

def initialize(catacomb:)
  @catacomb = catacomb
end

Instance Attribute Details

#catacombObject (readonly)

Returns the value of attribute catacomb.



24
25
26
# File 'lib/vaulty/vault_tree.rb', line 24

def catacomb
  @catacomb
end

Instance Method Details

#flattenObject



37
38
39
# File 'lib/vaulty/vault_tree.rb', line 37

def flatten
  flatten_tree(Array(render))
end

#treeObject



29
30
31
32
33
34
35
# File 'lib/vaulty/vault_tree.rb', line 29

def tree
  @tree ||= Folder.new(
    name: catacomb.path,
    data: read_values_for(catacomb.path),
    children: find_subtree(catacomb.path)
  )
end