Sha256: fab421ff2a30b78619dd01de51fb3418b28656e959e9853451b0cf92f29c6e52
Contents?: true
Size: 767 Bytes
Versions: 47
Compression:
Stored size: 767 Bytes
Contents
# frozen_string_literal: true module Spree module Preferences class PreferenceDifferentiator attr_reader :config_class def initialize(config_class) @config_class = config_class end def call(from:, to:) preferences_from = config_class.new.load_defaults(from) preferences_to = config_class.new.load_defaults(to) config_class.versioned_preferences.reduce({}) do |changes, pref_key| value_from = preferences_from[pref_key] value_to = preferences_to[pref_key] if value_from == value_to changes else changes.merge( pref_key => { from: value_from, to: value_to } ) end end end end end end
Version data entries
47 entries across 47 versions & 1 rubygems