Class: SnapshotArchive::Formatters::Show

Inherits:
Object
  • Object
show all
Defined in:
lib/snapshot_archive/formatters.rb

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(metadata) ⇒ Show

Returns a new instance of Show.



29
30
31
# File 'lib/snapshot_archive/formatters.rb', line 29

def initialize()
   = 
end

Instance Attribute Details

#metadata ⇒ Object (readonly)

Returns the value of attribute metadata.



28
29
30
# File 'lib/snapshot_archive/formatters.rb', line 28

def 
  
end

Class Method Details

.call(metadata) ⇒ Object



24
25
26
# File 'lib/snapshot_archive/formatters.rb', line 24

def self.call()
  new().call
end

Instance Method Details

#call ⇒ Object



33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
# File 'lib/snapshot_archive/formatters.rb', line 33

def call
  id = .fetch("id")
  timestamp = Time.parse(.fetch("timestamp")).strftime("%F %H:%M")
  message = .fetch("message")
  dir = .fetch("dir")

  Cfg.shell.puts("    id: \#{id}\n    time: \#{timestamp}\n    path: \#{dir}\n    ----------------------\n    \#{message}\n\n    Full metadata:\n    \#{JSON.pretty_generate(metadata.dig(\"archive\", \"stores\"))}\n  TXT\nend\n")