Sha256: 341518e453a2eb22c091bac44648144dd799268d593ff11548911ca9c0bb954a
Contents?: true
Size: 984 Bytes
Versions: 7
Compression:
Stored size: 984 Bytes
Contents
# frozen_string_literal: true require_relative 'version_helpers' module PaperTrailScrapbook # Class Chapter provides single version history analysis # # @author Timothy Chambers <tim@possibilogy.com> # class Chapter include Concord.new(:version) include Adamantium::Flat include PaperTrailScrapbook::VersionHelpers # Single version historical analysis # # @return [String] Human readable description of changes # def story updates = changes return unless tell_story?(updates) [preface, (updates unless destroy?)].compact.join("\n") end private def preface "On #{whenn}, #{who} #{kind} #{what}".squeeze(' ') end def what if destroy? "#{model}#{item_id}" else "the following #{model}#{item_id} info:" end end def item_id; end def tell_story?(updates) create? || destroy? || updates.present? || !config.filter_non_changes end end end
Version data entries
7 entries across 7 versions & 1 rubygems