Module: Shrine::Plugins::Derivatives::VersionsCompatibility

Defined in:
lib/shrine/plugins/derivatives.rb

Overview

Adds compatibility with how the versions plugin stores processed files.

Instance Method Summary collapse

Instance Method Details

#load_data(data) ⇒ Object


622
623
624
625
626
627
628
629
630
631
# File 'lib/shrine/plugins/derivatives.rb', line 622

def load_data(data)
  return super if data.nil?
  return super if data["derivatives"] || data[:derivatives]
  return super if (data["id"] || data[:id]).is_a?(String)

  data     = data.dup
  original = data.delete("original") || data.delete(:original) || {}

  super original.merge("derivatives" => data)
end