Class: PaperTrailScrapbook::Versions Private

Inherits:
Object
  • Object
show all
Defined in:
lib/paper_trail_scrapbook/versions.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.

Fetches available versions and related version info Provides filtering

Instance Method Summary collapse

Instance Method Details

#filtered(object_versions) ⇒ Object

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.



19
20
21
22
23
# File 'lib/paper_trail_scrapbook/versions.rb', line 19

def filtered(object_versions)
  return object_versions unless object.respond_to?(:version_filter)

  object_versions.select { |v| object.version_filter(v) }
end

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.



13
14
15
16
17
# File 'lib/paper_trail_scrapbook/versions.rb', line 13

def related_content
  return [] unless object.respond_to?(:trailed_related_content)

  object.trailed_related_content.compact.flat_map(&:versions)
end

#versionsObject

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.



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

def versions
  filtered(object.versions | related_content).sort_by(&:created_at)
end