Class: Cryptosphere::Tree

Inherits:
Blob
  • Object
show all
Defined in:
lib/cryptosphere/blobs/tree.rb

Defined Under Namespace

Classes: Entry

Constant Summary

Constants inherited from Blob

Blob::PREFIX

Instance Attribute Summary

Attributes inherited from Blob

#id, #key, #path

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from Blob

#decrypt, setup

Constructor Details

#initialize(entries) ⇒ Tree

Returns a new instance of Tree.



7
8
9
# File 'lib/cryptosphere/blobs/tree.rb', line 7

def initialize(entries)
  @entries = entries
end

Class Method Details

.[](*entries) ⇒ Object



3
4
5
# File 'lib/cryptosphere/blobs/tree.rb', line 3

def self.[](*entries)
  new(entries)
end

Instance Method Details

#to_sObject



11
12
13
# File 'lib/cryptosphere/blobs/tree.rb', line 11

def to_s
  @entries.sort_by { |e| e.name }.map(&:to_s).join("\n")
end