Class: SnapshotArchive::Formatters::List

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) ⇒ List

Returns a new instance of List.



9
10
11
# File 'lib/snapshot_archive/formatters.rb', line 9

def initialize()
  @metadata = 
end

Instance Attribute Details

#metadataObject (readonly)

Returns the value of attribute metadata.



8
9
10
# File 'lib/snapshot_archive/formatters.rb', line 8

def 
  @metadata
end

Class Method Details

.call(metadata) ⇒ Object



4
5
6
# File 'lib/snapshot_archive/formatters.rb', line 4

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

Instance Method Details

#callObject



13
14
15
16
17
18
19
20
# File 'lib/snapshot_archive/formatters.rb', line 13

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

  short_message = message.split("\n").first
  Cfg.shell.puts([id, timestamp, short_message].join(" : "))
end