Class: PaperTrailScrapbook::LifeHistory Private

Inherits:
Object
  • Object
show all
Defined in:
lib/paper_trail_scrapbook/life_history.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 LifeHistory provides Full multi version history

Author:

Instance Method Summary collapse

Constructor Details

#initialize(object) ⇒ LifeHistory

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 LifeHistory.



9
10
11
12
# File 'lib/paper_trail_scrapbook/life_history.rb', line 9

def initialize(object)
  @object   = object
  @versions = Versions.new(object).versions
end

Instance Method Details

#storyString

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.

Retries textual historical analysis of versions

Returns:

  • (String)

    analyzed versions



18
19
20
21
22
23
24
25
26
27
28
29
30
# File 'lib/paper_trail_scrapbook/life_history.rb', line 18

def story
  x = versions.map do |v|
    if primary?(v)
      Chapter
    else
      SecondaryChapter
    end.new(v).story
  end.compact

  x.reverse! if PaperTrailScrapbook.config.recent_first

  x.join("\n\n")
end