Class: PaperTrailScrapbook::LifeHistory Private
- Inherits:
-
Object
- Object
- PaperTrailScrapbook::LifeHistory
- 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
Instance Method Summary collapse
-
#initialize(object) ⇒ LifeHistory
constructor
private
A new instance of LifeHistory.
-
#story ⇒ String
private
Retries textual historical analysis of versions.
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 13 14 15 16 17 18 19 |
# File 'lib/paper_trail_scrapbook/life_history.rb', line 9 def initialize(object) @object = object @versions = object.versions if object.respond_to?(:trailed_related_content) object..compact.each do |trc| @versions |= trc.versions end end @versions = @versions.sort_by(&:created_at) end |
Instance Method Details
#story ⇒ String
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
25 26 27 28 29 30 31 32 33 34 35 36 37 |
# File 'lib/paper_trail_scrapbook/life_history.rb', line 25 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 |