Skip to content

Commit

Permalink
Alphabetize methods
Browse files Browse the repository at this point in the history
  • Loading branch information
jaredbeck committed Jan 3, 2019
1 parent baa9b1a commit 85884ba
Showing 1 changed file with 22 additions and 22 deletions.
44 changes: 22 additions & 22 deletions lib/paper_trail/events/base.rb
Original file line number Diff line number Diff line change
Expand Up @@ -111,28 +111,6 @@ def changed_in_latest_version
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
#
Expand Down Expand Up @@ -213,6 +191,13 @@ def model_metadatum(value, event)
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
Expand All @@ -238,6 +223,13 @@ def object_attrs_for_paper_trail(is_touch)
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,
Expand Down Expand Up @@ -286,6 +278,14 @@ def recordable_object(is_touch)
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

0 comments on commit 85884ba

Please sign in to comment.