Module: Yobi::LsMessageWrapper

Defined in:
lib/yobi/repository/ls.rb,
sig/yobi.rbs

Overview

Classifies a raw ls message Hash by its own message_type, wrapping it in the matching typed class. Used both as the ResticOutput transform: for Repository#ls and by LsOutcome's own post-hoc accessors.

Class Method Summary collapse

Class Method Details

.call(raw) ⇒ Yobi::Snapshot, ...

Returns the raw Hash itself for a message_type this version of Yobi doesn't recognize.

Parameters:

  • raw (Hash)

Returns:



49
50
51
52
53
54
55
# File 'lib/yobi/repository/ls.rb', line 49

def self.call(raw)
  case raw["message_type"]
  when "snapshot" then Snapshot.new(raw)
  when "node" then Node.new(raw)
  else raw
  end
end