Class: DraftApprove::Serialization::Json::Serializer Private
- Inherits:
-
Object
- Object
- DraftApprove::Serialization::Json::Serializer
- Defined in:
- lib/draft_approve/serialization/json/serializer.rb
Overview
This class is part of a private API. You should avoid using this class if possible, as it may be removed or be changed in the future.
Logic for serializing changes to ActiveRecord models into JSON format, and deserializing the changes on a Draft
object into the new values for an ActiveRecord model.
Class Method Summary collapse
-
.changes_for_model(model) ⇒ Hash
private
Serialize changes on an ActiveRecord model into a JSON representation of the changes.
-
.new_values_for_draft(draft) ⇒ Hash
private
Deserialize changes from a
Draft
object into the new values for theacts_as_draftable
ActiveRecord model the draft relates to.
Class Method Details
.changes_for_model(model) ⇒ Hash
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
Serialize changes on an ActiveRecord model into a JSON representation of the changes.
23 24 25 |
# File 'lib/draft_approve/serialization/json/serializer.rb', line 23 def self.changes_for_model(model) JsonSerializer.new(model).changes_for_model end |
.new_values_for_draft(draft) ⇒ Hash
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
Deserialize changes from a Draft
object into the new values for the acts_as_draftable
ActiveRecord model the draft relates to.
39 40 41 |
# File 'lib/draft_approve/serialization/json/serializer.rb', line 39 def self.new_values_for_draft(draft) JsonDeserializer.new(draft).new_values_for_draft end |