Class: PaperTrailScrapbook::Changes Private

Inherits:
Object
  • Object
show all
Includes:
Adamantium::Flat, VersionHelpers
Defined in:
lib/paper_trail_scrapbook/changes.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.

Class Changes provides detailed attribute by attribute analysis

Author:

Constant Summary collapse

POLYMORPH_BT_INDICATOR =

This constant is part of a private API. You should avoid using this constant if possible, as it may be removed or be changed in the future.

'*'
BULLET =

This constant is part of a private API. You should avoid using this constant if possible, as it may be removed or be changed in the future.

''

Instance Method Summary collapse

Methods included from VersionHelpers

#config, #create?, #destroy?, #kind, #model, #model_id, #whenn, #who, #whodunnit_class, #whodunnit_instance

Constructor Details

#initializeChanges

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.

Returns a new instance of Changes.



17
18
19
20
21
# File 'lib/paper_trail_scrapbook/changes.rb', line 17

def initialize(*)
  super
  build_associations
  changes
end

Instance Method Details

#change_logString

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.

Attribute change analysis

Returns:

  • (String)

    Summary analysis of changes



30
31
32
33
34
35
36
37
38
39
# File 'lib/paper_trail_scrapbook/changes.rb', line 30

def change_log
  text =
    changes
    .map { |k, v| digest(k, v) }
    .compact
    .join("\n")

  text = text.gsub(' id:', ':') if PaperTrailScrapbook.config.drop_id_suffix
  text
end