Class: PaperTrail::RelatedChanges::Serializer::Diff

Inherits:
Struct
  • Object
show all
Defined in:
lib/paper_trail/related_changes/serializer/diff.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

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

#attributeObject

Returns the value of attribute attribute

Returns:

  • (Object)

    the current value of attribute



2
3
4
# File 'lib/paper_trail/related_changes/serializer/diff.rb', line 2

def attribute
  @attribute
end

#metaObject

Returns the value of attribute meta

Returns:

  • (Object)

    the current value of meta



2
3
4
# File 'lib/paper_trail/related_changes/serializer/diff.rb', line 2

def meta
  @meta
end

#newObject

Returns the value of attribute new

Returns:

  • (Object)

    the current value of new



2
3
4
# File 'lib/paper_trail/related_changes/serializer/diff.rb', line 2

def new
  @new
end

#oldObject

Returns the value of attribute old

Returns:

  • (Object)

    the current value of old



2
3
4
# File 'lib/paper_trail/related_changes/serializer/diff.rb', line 2

def old
  @old
end

#rankObject

Returns the value of attribute rank

Returns:

  • (Object)

    the current value of rank



2
3
4
# File 'lib/paper_trail/related_changes/serializer/diff.rb', line 2

def rank
  @rank
end

#sourceObject

Returns the value of attribute source

Returns:

  • (Object)

    the current value of source



2
3
4
# File 'lib/paper_trail/related_changes/serializer/diff.rb', line 2

def source
  @source
end

#source_rankObject

Returns the value of attribute source_rank

Returns:

  • (Object)

    the current value of 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

Returns:

  • (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

#hashObject



19
20
21
# File 'lib/paper_trail/related_changes/serializer/diff.rb', line 19

def hash
  [attribute, new, old].hash
end

#to_hObject



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