Class: PaperTrail::Human::Core::BatchPresenter

Inherits:
Object
  • Object
show all
Includes:
AfterFormat
Defined in:
lib/paper_trail/human/core/batch_presenter.rb

Instance Method Summary collapse

Constructor Details

#initialize(configuration) ⇒ BatchPresenter

Returns a new instance of BatchPresenter.



9
10
11
12
# File 'lib/paper_trail/human/core/batch_presenter.rb', line 9

def initialize(configuration)
  @configuration = configuration
  @change_extractor = ChangeExtractor.new
end

Instance Method Details

#call(versions, only: nil, except: nil) ⇒ Object



14
15
16
17
18
19
20
21
# File 'lib/paper_trail/human/core/batch_presenter.rb', line 14

def call(versions, only: nil, except: nil)
  versions_data = versions.map { |v| [v, @change_extractor.call(v)] }
  preloaded = preload_relations(versions_data)

  versions_data.map do |version, changes|
    format_version(version, changes, preloaded, only: only, except: except)
  end
end