Alphabetize methods

This commit is contained in:
Jared Beck 2019-01-02 19:04:17 -05:00
parent baa9b1a9cd
commit 85884ba06c
1 changed files with 22 additions and 22 deletions

View File

@ -111,28 +111,6 @@ module PaperTrail
changes_in_latest_version.keys
end
# @api private
def prepare_object_changes(changes)
changes = serialize_object_changes(changes)
changes = recordable_object_changes(changes)
changes
end
# @api private
def serialize_object_changes(changes)
AttributeSerializers::ObjectChangesAttribute.
new(@record.class).
serialize(changes)
changes.to_hash
end
# @api private
def notable_changes
changes_in_latest_version.delete_if { |k, _v|
!notably_changed.include?(k)
}
end
# Rails 5.1 changed the API of `ActiveRecord::Dirty`. See
# https://github.com/paper-trail-gem/paper_trail/pull/899
#
@ -213,6 +191,13 @@ module PaperTrail
end
end
# @api private
def notable_changes
changes_in_latest_version.delete_if { |k, _v|
!notably_changed.include?(k)
}
end
# @api private
def notably_changed
only = @record.paper_trail_options[:only].dup
@ -238,6 +223,13 @@ module PaperTrail
attrs
end
# @api private
def prepare_object_changes(changes)
changes = serialize_object_changes(changes)
changes = recordable_object_changes(changes)
changes
end
# Returns an object which can be assigned to the `object_changes`
# attribute of a nascent version record. If the `object_changes` column is
# a postgres `json` column, then a hash can be used in the assignment,
@ -286,6 +278,14 @@ module PaperTrail
PaperTrail.serializer.dump(object_attrs_for_paper_trail(is_touch))
end
end
# @api private
def serialize_object_changes(changes)
AttributeSerializers::ObjectChangesAttribute.
new(@record.class).
serialize(changes)
changes.to_hash
end
end
end
end