Class: PaperTrail::RelatedChanges::Serializer::Diff
- Inherits:
-
Struct
- Object
- Struct
- PaperTrail::RelatedChanges::Serializer::Diff
- Defined in:
- lib/paper_trail/related_changes/serializer/diff.rb
Instance Attribute Summary collapse
-
#attribute ⇒ Object
Returns the value of attribute attribute.
-
#meta ⇒ Object
Returns the value of attribute meta.
-
#new ⇒ Object
Returns the value of attribute new.
-
#old ⇒ Object
Returns the value of attribute old.
-
#rank ⇒ Object
Returns the value of attribute rank.
-
#source ⇒ Object
Returns the value of attribute source.
-
#source_rank ⇒ Object
Returns the value of attribute source_rank.
Instance Method Summary collapse
- #eql?(other) ⇒ Boolean
- #hash ⇒ Object
-
#initialize(rank: 1, source_rank: 1, **args) ⇒ Diff
constructor
A new instance of Diff.
- #to_h ⇒ Object
Constructor Details
#initialize(rank: 1, source_rank: 1, **args) ⇒ Diff
Returns a new instance of Diff.
3 4 5 |
# File 'lib/paper_trail/related_changes/serializer/diff.rb', line 3 def initialize(rank: 1, source_rank: 1, **args) super end |
Instance Attribute Details
#attribute ⇒ Object
Returns the value of attribute attribute
2 3 4 |
# File 'lib/paper_trail/related_changes/serializer/diff.rb', line 2 def attribute @attribute end |
#meta ⇒ Object
Returns the value of attribute meta
2 3 4 |
# File 'lib/paper_trail/related_changes/serializer/diff.rb', line 2 def @meta end |
#new ⇒ Object
Returns the value of attribute new
2 3 4 |
# File 'lib/paper_trail/related_changes/serializer/diff.rb', line 2 def new @new end |
#old ⇒ Object
Returns the value of attribute old
2 3 4 |
# File 'lib/paper_trail/related_changes/serializer/diff.rb', line 2 def old @old end |
#rank ⇒ Object
Returns the value of attribute rank
2 3 4 |
# File 'lib/paper_trail/related_changes/serializer/diff.rb', line 2 def rank @rank end |
#source ⇒ Object
Returns the value of attribute source
2 3 4 |
# File 'lib/paper_trail/related_changes/serializer/diff.rb', line 2 def source @source end |
#source_rank ⇒ Object
Returns the value of attribute source_rank
2 3 4 |
# File 'lib/paper_trail/related_changes/serializer/diff.rb', line 2 def source_rank @source_rank end |
Instance Method Details
#eql?(other) ⇒ Boolean
15 16 17 |
# File 'lib/paper_trail/related_changes/serializer/diff.rb', line 15 def eql?(other) attribute == other.attribute && new == other.new && old == other.old end |
#hash ⇒ Object
19 20 21 |
# File 'lib/paper_trail/related_changes/serializer/diff.rb', line 19 def hash [attribute, new, old].hash end |
#to_h ⇒ Object
7 8 9 10 11 12 13 |
# File 'lib/paper_trail/related_changes/serializer/diff.rb', line 7 def to_h if ENV['RELATED_CHANGES_DEBUG'] super else super.except(:rank, :source, :source_rank, :meta) end end |