Module: Yobi::DiffMessageWrapper

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

Overview

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

Class Method Summary collapse

Class Method Details

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

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

Parameters:

  • raw (Hash)

Returns:



31
32
33
34
35
36
37
# File 'lib/yobi/repository/diff.rb', line 31

def self.call(raw)
  case raw["message_type"]
  when "change" then DiffChange.new(raw)
  when "statistics" then DiffStatistics.new(raw)
  else raw
  end
end