user_settings_serializer.rb 299 B

12345678910111213141516171819
  1. # frozen_string_literal: true
  2. class UserSettingsSerializer
  3. def self.load(value)
  4. json = begin
  5. if value.blank?
  6. {}
  7. else
  8. Oj.load(value, symbol_keys: true)
  9. end
  10. end
  11. UserSettings.new(json)
  12. end
  13. def self.dump(value)
  14. Oj.dump(value.as_json)
  15. end
  16. end