Class: PaperTrailScrapbook::UserJournal Private
- Inherits:
-
Object
- Object
- PaperTrailScrapbook::UserJournal
- Includes:
- Adamantium::Flat
- Defined in:
- lib/paper_trail_scrapbook/user_journal.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 UserJournal provides history for a user, optionally scoped by object class and/or date range
Instance Method Summary collapse
-
#initialize(user, opts = {}) ⇒ UserJournal
constructor
private
A new instance of UserJournal.
-
#story ⇒ String
private
Retries textual historical analysis of versions.
Constructor Details
#initialize(user, opts = {}) ⇒ UserJournal
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 UserJournal.
12 13 14 15 16 17 18 19 20 |
# File 'lib/paper_trail_scrapbook/user_journal.rb', line 12 def initialize(user, opts = {}) @user = user @user_id = String(user.id) @options = opts @starts = [:start] || Time.at(0).in_time_zone @ends = [:end] || Time.current.in_time_zone @versions = PaperTrail::Version.where(query_params) 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
26 27 28 29 30 31 32 33 34 35 36 |
# File 'lib/paper_trail_scrapbook/user_journal.rb', line 26 def story s = versions.map do |v| JournalEntry.new(v).story end.compact s.reverse! if PaperTrailScrapbook.config.recent_first s.join("\n\n") "#{preface}#{s.presence || 'No history'}" end |