Sha256: 044220e259444814ad4fb9007a36b33e1971a9402d6caa426ace7aa15d5ed8ea

Contents?: true

Size: 732 Bytes

Versions: 3

Compression:

Stored size: 732 Bytes

Contents

require_relative 'version_helpers'

module PaperTrailScrapbook
  # Class JournalEntry provides single version history analysis
  #
  # @author Jason Dinsmore <jason@dinjas.com>
  #
  class JournalEntry
    include Concord.new(:version)
    include Adamantium::Flat
    include PaperTrailScrapbook::VersionHelpers

    delegate :event, to: :version

    # Single version historical analysis
    #
    # @return [String] Human readable description of changes
    #
    def story
      updates = changes
      return unless create? || updates.present? || !config.filter_non_changes

      "#{preface}\n#{updates}"
    end

    private

    def preface
      "On #{whenn}, #{kind} #{model}[#{model_id}]:".squeeze(' ')
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
paper_trail_scrapbook-0.1.9 lib/paper_trail_scrapbook/journal_entry.rb
paper_trail_scrapbook-0.1.8 lib/paper_trail_scrapbook/journal_entry.rb
paper_trail_scrapbook-0.1.7 lib/paper_trail_scrapbook/journal_entry.rb